Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Closes on Refresh

Status
Not open for further replies.

gfender

IS-IT--Management
May 22, 2003
55
GB
I've been trying to find out why my sessions close when I hit the refresh button. Does it have something to do with a new sessionID? I understand that when the browser is closed the sessions close, does refreshing do the same thing? If so, is there any way to fix this.

Thanks.
Gabe
 
are you sure sessions are actually closing and not just being overwritten with a new session( provided that the page you are refreshing is the one that creates the session)?

that is the behavior that i would expect

Bastien

cat, the other other white meat
 
Ok, i looked in the /tmp folder and the sessions are not closing, a new session is just being created everything the window refreshes.
 
Exactly what of PHP's session-handling functions are you using how?

On my PHP installation, the following code:

Code:
<?php
session_start();

if (!array_key_exists('foo', $_SESSION))
{
	$_SESSION['foo'] = 1;
	print &quot;first run&quot;;
}
else
{
	print '<pre>';
	print session_id();
	print &quot;\n&quot;;
	print_r ($_SESSION);
}
?>

outputs &quot;first run&quot; the first time the script is invoked, and the same session ID and session variable contents on all successive runs.

Want the best answers? Ask the best questions: TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top