Re: Session Not Working

From: Date: Sat, 22 Mar 2003 03:40:28 +0000
Subject: Re: Session Not Working
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140660@lists.php.net to get a copy of this message
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" <gurugeek2002@g-i-w-s.com> wrote in message news:3E7B84C7.841F873E@g-i-w-s.com... > 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 > > > > > > >

« previous php.general (#140660) next »