note 35941 deleted from function.setcookie by tularis
| From: | tularis@php.net | Date: | Sun, 02 Jan 2005 14:24:22 +0000 |
| Subject: | note 35941 deleted from function.setcookie by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82592@lists.php.net to get a copy of this message | ||
Note Submitter: Eugene at php at burtsev dot com
----
This is my way of finding out if cookies are on and if session ID needs to be sent as URL:
<?PHP
session_start();
$self = $_SERVER['PHP_SELF'];
if (!$_GET['sID'] && !$_SESSION['cookie'])
{
$sID = session_id();
header ("Location: $self" . "?sID=$sID");
exit;
}
if (!$_SESSION['cookie']){
if (session_id() == $_GET['sID']) {
$_SESSION['cookie'] = "1";
header ("Location: $self");
exit;
} else {
$_SESSION['cookie'] = "0";
session_id($_GET['sID']);
}
}
print "Result is: " . $_SESSION['cookie'];
?>
I call it ones during logon, but don't see any harm in calling it with page.
Cheers
Eugene