Re: session management

From: Date: Thu, 24 Oct 2002 03:31:55 +0000
Subject: Re: session management
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-121197@lists.php.net to get a copy of this message
How can I see if the session cookie is being set? I get the same behavior with Internet Explorer 6.0 and Netscape 7.0. Both browsers have all cookies enabled. Are there session parameters I can check in php.ini or elsewhere? I noticed I also get "Undefined index: count on line 4" in the Apache error.log file with the original script I submitted. I tried 3 different scripts below, which don't give me the undefined error, but still create new sess_* files every time I refresh & don't update the counter: ////////// <?php session_start(); // Use $HTTP_SESSION_VARS with PHP 4.0.6 or less if (!isset($_SESSION['count'])) { $_SESSION['count'] = 0; } else { $_SESSION['count']++; } echo "<P>You've been here {$_SESSION['count']} times. Thanks! </P>"; ?> ////////// <?php session_start(); if (isset($HTTP_SESSION_VARS['count'])) { $HTTP_SESSION_VARS['count']++; } else { $HTTP_SESSION_VARS['count'] = 0; } echo "<P>You've been here {$HTTP_SESSION_VARS['count']} times. Thanks! </P>"; ?> ////////// <?php if (!session_is_registered('count')) { session_register('count'); $count = 1; } else { $count++; } ?> Hello visitor, you have seen this page <?php echo $count; ?> times.<p> ////////// Thanks, -z63072 ----- Original Message ----- From: "Jason Wong" <php-general@gremlins.com.hk> Newsgroups: php.general To: <php-general@lists.php.net> Sent: Wednesday, October 23, 2002 12:07 AM Subject: Re: [PHP] session management > On Wednesday 23 October 2002 09:49, z63072 wrote: > > > > It just keeps replying "You've been here 1 times" and new session files > > (sess_2ff69ce53e8e0bbfe62a8b0face3ebf6, etc) are created in c:\temp\ every > > time I refresh the page, and count doesn't get incremented. What am I > > missing here? > > That's probably because your browser is not accepting cookies. > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > FOOLED you! Absorb EGO SHATTERING impulse rays, polyester poltroon!! > */ >

« previous php.general (#121197) next »