RE: [PHP] Session problem

From: Date: Tue, 07 Aug 2001 13:37:27 +0000
Subject: RE: [PHP] Session problem
Groups: php.general 
Request: Send a blank email to php-general+get-61628@lists.php.net to get a copy of this message
oh i forgot!!! you have to put this at the beginning of your page <?php session_start(); ?> indeed it's not working properly, first of all please make sur the pages are not cashed send a header (Cache-control: NO cache) i'm not sure about the syntax so check the manual then try to modify your code like this and tell us what happens: <?php if (!HTTP_SESSION_VARS['count']) { global $count; $count = 0; session_register ("count"); echo "Hello visitor, you have seen this page $count; times"; } else { $count = HTTP_SESSION_VARS['count']; $count++; session_register ("count"); echo "Hello visitor, you have seen this page ".HTTP_SESSION_VARS['count']"."; times"; ?> might seem a little overloaded but it's to make sur there is no confusion between count as a session var and the other var; if this is not working then the problem is else whrere and w'll continue lokkin :)) regards At 15:41 07/08/01, you wrote:
Still loses it .. check this out: http://www.militarycity.com/classified/realtors/count.php The entire code for that page, taken from an example on zend: <?php session_register ("count"); $count++; ?> Hello visitor, you have seen this page <?php echo $count; ?> times.<p> Try loading it about 10 times or so, watch what happens. Chad -----Original Message----- From: hassan el forkani [mailto:webmaster@warmafrica.com] Sent: Tuesday, August 07, 2001 8:34 AM To: Chad Day Subject: RE: [PHP] Session problem hello At 15:16 07/08/01, you wrote: My code:
auth.php: session_start(); ... $res = mysql_query("SELECT NAME FROM dbhere where EMAIL = '$EMAIL' AND PASSWORD = '$PASSWORD'"); if ($row = mysql_fetch_array($res)) {
//try adding this:
         global $NAME;
$NAME = $row[NAME]; session_register("NAME"); } ... Header("Location: menu.php");
regards


« previous php.general (#61628) next »