Session logic question
| From: | Al | Date: | Fri, 02 Jan 2004 18:21:40 +0000 |
| Subject: | Session logic question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-173645@lists.php.net to get a copy of this message | ||
I use the $_SESSION buffer extensively on my site without a problem, except one.
Maybe someone can help me understand the problem.
I have a simple page counter with a test to see if the page has been counted for the user.
start_session();
*
* [additional code]
*
if($_SESSION['ctr_file']!==$counterFile) //See if visitor has already been counted for this page
{$num = $num+1; $_SESSION['ctr_file'] = $counterFile; //set/reset counter file for next time
Pages that use the counter function all have a start_session(); and a call to the counter function,
Everything works fine, except when I include another script file that also uses the $_SESSION buffer.
What appears to be happening is that start_session() on the second script reinitializes the session buffer and I lose the data from the first session.
Yet, as I read php manual, it seems to say that start_session is suppose to simply restore the variables for the page it is on; not start a new session.
many thanks....