Try

if ( isset($_SESSION['verified_user'])==1) {
...
}

or in main.php try to print out if there any variable or not?

<?PHP
session_start();
print_r($_SESSION['verified_user']);
?>

"Guru Geek" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
>
> I'm trying to use sessions for the first time.
>
> I have a log in script that gets the user to enter their name and
> password.  Then the script compares the entered data to a database.  If
> the entered data matches whats in the database then the user is granted
> access to the main php script.
>
> basically my code in the log in script is this:
>
> if ($user_data = = $database_data) {
> $_SESSION['verified_user']=1;
> header("Location:http://www.myserver.com/main.php";);
> exit;
>
> The opening code in my main.php script is this:
> session_start();
> if ( isset($_SESSION['verified_user'])) {
> run the whole script
> }else {
> return to log in page
> exit;
> }
>
> Anyone care to clue me in as to why I'm always sent back to the log in
> page even when the log in is correct?
>
> Did I miss the session boat all together?  Perhaps I'm not grasping it
> at all..
>
> Thanks,
> Roger
>
>
>
>
>
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to