this code works on my machines:

<?php

header ("Cache-Control: no-cache, must-revalidate, max_age=0");
session_start();
if ($HTTP_SESSION_VARS['count'])
{
$count = $HTTP_SESSION_VARS['count'];
$count++;
session_register ("count");
echo "Hello visitor, you have seen this page 
".$HTTP_SESSION_VARS['count']." times";

}
else
{
global $count;
$count = 1;
session_register("count");
echo "Hello visitor, you have never seen this page before";
}
?>

test it, i think the problem was about starting $count at zero;
if it still ait working for you then check your php.ini settings
regards

At 16:50 07/08/01, Chad Day wrote:
>Done, still not working.   I know that usually has to be there, I was just
>going to copy the example from the manual directly, since the session should
>automatically kickoff when it hits the session_register bit.  This truly has
>me baffled.
>
>Chad
>
>-----Original Message-----
>From: hassan el forkani [mailto:[EMAIL PROTECTED]]
>Sent: Tuesday, August 07, 2001 9:37 AM
>To: Chad Day
>Cc: [EMAIL PROTECTED]
>Subject: RE: [PHP] Session problem
>
>
>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:[EMAIL PROTECTED]]
> >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
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to