ID:               17441
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
 Status:           Open
 Bug Type:         Session related
 Operating System: windows
 PHP Version:      4.2.1
 New Comment:

oops - left out session_register("count"); so the code looks like
this:
<?php
session_start();

if (isset($HTTP_SESSION_VARS['count'])) {
   $HTTP_SESSION_VARS['count']++;
}
else {
        print "NOT registered session:";
         session_register("count");
        $HTTP_SESSION_VARS['count']=0;
}


?>

Hello visitor, you have seen this page <?php echo
$HTTP_SESSION_VARS['count'] ?> times.<p>


To continue, <A HREF="http://localhost/index.php?<?php echo
SID?>">click here</A>


Previous Comments:
------------------------------------------------------------------------

[2002-05-26 16:40:37] [EMAIL PROTECTED]

I've been scratching my head over this for sometime now.
I'm sure I'm doing something wrong and hope someone can help. The
problem is simple: 
<?php
session_start();

if (isset($HTTP_SESSION_VARS['count']))
{
   $HTTP_SESSION_VARS['count']++;
}
else
{
        print "NOT registered:";
        $HTTP_SESSION_VARS['count']=0;
}


?>

Hello visitor, you have seen this page <?php echo
$HTTP_SESSION_VARS['count'] ?> times.<p>


To continue, <A HREF="http://localhost/jobs4us/main.php?<?php echo
SID?>">click here</A>



-- The above code is available on the  php site.
Problem:every time I reload the above page, or link to it from another
page, $HTTP_SESSION_VARS['count'] always shows 0. Why? I can see the
session is saved in my temp file (size 1K), but when i reload the page,
why does the code 'think' that the session is not registered? Of
course, I tried session_is registered("count") but to no avail. Any
help would be appreciated. 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=17441&edit=1

Reply via email to