PROBLEM WITH SESSIONS
| From: | Dale | Date: | Wed, 07 May 2003 22:40:44 +0000 |
| Subject: | PROBLEM WITH SESSIONS | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-146752@lists.php.net to get a copy of this message | ||
I am having a problem with a session. I currently have three main pages:
1. main.php
2. validate.php
3. manager.php
the code for main.php is basically a form which passes two variables:
a. username
b. password
the code for validate is as follows:
...
if($numRows > 0)
{
$row=mssql_fetch_array($result);
session_register("validUser25");
$validUser=$row["idNum"];
session_register("name");
$name=$row["firstName"];
$name.=" ";
$name.=$row["lastName"];
session_register("type");
$type=$row["type"];
//echo "type: $type <BR>";
//echo "name: $name <BR>";
//echo "idnum: $validUser<BR>";
header("Location: employee_mngr/main.php");
//exit;
} else
{
}
manager.php:
<?
session_start();
//STOPS USER FROM BYPASSING LOGIN SCREEN
if(!session_is_registered("validUser"))
{
echo "name: $name <BR>";
echo "name: $validUser <BR>";
echo "type: $type <BR>";
echo "The session is not registered!!!";
exit;
}
The problem that I am having is that in validate.php I start a session, but
for some reason when the re-direct occurs, the session is no longer valid.
If I, however, hit the back button on the browser, and re-login the session
now becomes valid.
I can't figure this out.
Thanks,
- Dale