--trans-sid + redeclaring PHPSESSID
| From: | Derek Sivers | Date: | Tue, 21 Nov 2000 07:57:33 +0000 |
| Subject: | --trans-sid + redeclaring PHPSESSID | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26404@lists.php.net to get a copy of this message | ||
A bit of obvious but useful PHP:
If you ever need to header ("Location:...") someone, but want to maintain state...
BUT you don't want to add the Session ID to the URL if it was previously transparent...
TRY THIS:
if ($variables = strstr($REQUEST_URI, "?"))
{
header ("Location: /yoururl.php" . $variables);
}
else
{
header ("Location: /yoururl.php");
}
die();
It now works with and without cookies enabled.