ok, let me post some sample code (here are the relevant snippets)
<?
session_start();
echo "sessionid".session_id();
if ($login)
{
// validate username and password
session_register("s_user_name");
session_register("s_password");
$GLOBALS['s_user_name'] = $username;
$GLOBALS['s_password'] = $password;
}
?>
<form method="post" action="<?echo $PHP_SELF;?>">
<tr>
<td>Username</td>
<td>
<input type="text" name="username"></input>
</td>
</tr>
<tr>
<td>Password</td>
<td>
<input type="password" name="password"></input>
</td>
</tr>
<tr>
<td>
<input type="submit" name="login" value="login"></input>
</td>
</tr>
<tr>
<td>
<a href="anotherpage.php">Link to Another Page</a>
</td>
</tr>
</form>
Ok, so a user comes to the homepage in a new browser instance, upon arrival, a session ID is echoed out:
sessionid13151a4bd7886078fc16d432f462c094
Now the user logs in and hits the login submit button. The page refreshes and the following user id is echoed out:
sessionid13151a4bd7886078fc16d432f462c094
Everything is ok so far, session information is stored. Now the user clicks to "anotherpage.php". This page looks like:
<?
session_start();
echo "sessionid".session_id();
?>
<tr>
<td>Some Random Content</td>
</tr>
Well, the session ID echoed out when this page loads is:
sessionidc4b481d1aded1cab9d69df3745518ad7
And I have lost all my session information. If I then go to the homepage, this new session ID remains the same. If I login again, the new session ID remains the same and if I click the "anotherpage.php" link, the new session ID remains the same -- meaning it works.
Do you know why I lose my session information when I link to another page in a new browser instance or the first login at this site within a browser instance.
Here are some relevant settings:
session.auto_start = 1
session.use_cookies = 1
session.cookie_lifetime = 0
session.use_trans_sid = 1
Why do I have a session ID when I first visit the site before I login, is that session ID coming from a cookie?
Thanks, any help will be appreciated.
Raj