Session Not Working
| From: | Guru Geek | Date: | Fri, 21 Mar 2003 21:31:51 +0000 |
| Subject: | Session Not Working | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-140638@lists.php.net to get a copy of this message | ||
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