note 35941 added to function.setcookie

From: Date: Fri, 19 Sep 2003 18:11:45 +0000
Subject: note 35941 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-56785@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.setcookie.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35941 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35941&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35941&report=yes

« previous php.notes (#56785) next »