I'm facing a weird problem here.. (session)
Perhaps the server settings or php settings.

Here's the code:

if (empty($_SESSION['count'])) {
   $_SESSION['count'] = 1;
} else {
   $_SESSION['count']++;
}
?>

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

Everytime i hit refresh, the counter should increase..
but for some reason it doesn't and i dont know why.

Any idea / suggestion / solution for me?

Thank you

    4 days later

    Is there a [man]session_start/man at the top of this script?

    If you echo out [man]session_id/man each time, does the id change or stay the same?

      10 days later

      found the problem..

      the server time is wrong

        9 days later
        nagasea wrote:

        found the problem..

        the server time is wrong

        How does server time relate to you session that has nothing to do about the time? 😮

          faifas wrote:

          How does server time relate to you session that has nothing to do about the time? 😮

          It's possible that the server (or script) set the session.cookie_lifetime value to something other than 0. If the time was wrong and the cookie_lifetime wasn't large enough to overcome this time difference, the cookie would have expired as soon as the browser read the "expires" parameter.

            bradgrafelman wrote:

            It's possible that the server (or script) set the session.cookie_lifetime value to something other than 0. If the time was wrong and the cookie_lifetime wasn't large enough to overcome this time difference, the cookie would have expired as soon as the browser read the "expires" parameter.

            Thanks \o/

              Write a Reply...