note 23957 added to ref.session
| From: | rainer@php.net | Date: | Fri, 02 Aug 2002 07:48:59 +0000 |
| Subject: | note 23957 added to ref.session | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-34124@lists.php.net to get a copy of this message | ||
@ericnielsen's comment from 08-Mar-02
To append session ids to local header calls when using GET-based session fallback mode (PHP does not
automatically) I do the following using a relative path and the SID constant:
function localRedirect($relPath)
{
$url = "http://".$_SERVER['HTTP_HOST'].
dirname($_SERVER['PHP_SELF'])."/".$relPath;
if (defined("SID") && SID != "") {
$url .= "&".SID;
}
header("Location: ".$url);
exit;
}
In this way the session ids are maintained across local redirects without getting any "Accept
Cookie" dialogs to pop up on every page. I check the constant SID instead of Cookie-Params,
because SID is only defined (automatically by PHP), if the client did not send the appropriate
cookie.
Regards Rainer Kuhn
--
http://www.php.net/manual/en/ref.session.php
http://master.php.net/manage/user-notes.php?action=edit+23957
http://master.php.net/manage/user-notes.php?action=delete+23957
http://master.php.net/manage/user-notes.php?action=reject+23957