note 46608 added to function.session-start

From: Date: Sun, 17 Oct 2004 06:28:54 +0000
Subject: note 46608 added to function.session-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-78689@lists.php.net to get a copy of this message
I am sure anybody that is trying to use IIS and PHP is throughly annoyed with the session_start() bug that recreates a new session every time it is accessed. The problem is the session_id isn't passed before the session_start() so it creates a new session. So a simple sollution is: $id = 473483478383834; session_id($id); session_start(); Another way that is a bit more dynamic using a Cookie to hold the session_id: if (isset($SessID)){ session_id($SessID); } session_start(); header("Cache-control: private"); // IE 6 Fix. setcookie("SessID", session_id(), time() + 3600); There are probably much better ways of doing this but for use with my offline Win/IIS setup it seems to be fine. ---- Manual Page -- http://www.php.net/manual/en/function.session-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+46608 Delete -- http://master.php.net/manage/user-notes.php?action=delete+46608&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+46608&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+46608&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+46608&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+46608&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+46608&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+46608&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#78689) next »