note 25246 deleted from ref.session by sniper
| From: | sniper@php.net | Date: | Tue, 21 Jan 2003 03:14:29 +0000 |
| Subject: | note 25246 deleted from ref.session by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42473@lists.php.net to get a copy of this message | ||
I've noticed that when the session ID is propgated in GET mode, the SID string isn't added
to the URL when the first page that is loaded. This means that if refresh is hit for some reason a
new session starts. I have corrected this with the following code :-
session_start(); // Start the PHP Session
if (!isset($HTTP_COOKIE_VARS[session_name()]) && !isset($HTTP_GET_VARS[session_name()])) {
$PROTOCOL = ((isset($HTTPS) && $HTTPS == 'on')) ? "https" :
"http";
session_write_close();
header("Location: ". $PROTOCOL. "://".$HTTP_HOST.$PHP_SELF . "?"
. SID . (empty($HTTP_SERVER_VARS['QUERY_STRING']) ? "" : "&" .
$HTTP_SERVER_VARS['QUERY_STRING']));
}