I'm trying to get session variables working with my PHP v4.3.6. I know its pretty much built in with that version, but for some reason I'm having problems (its probably my ineptitude). I'm trying to get a simple counter working, here's what my code looks like:
<?php
session_start();
if (!session_is_registered('count')) {
session_register('count');
$count = 1;
} else {
$count++;
}
?>
<p>
Hello visitor, you have seen this page <?php echo $count; ?> times.
</p>
<p>
To continue, <a href="nextpage.php?<?php echo strip_tags(SID); ?>">click
here</a>.
</p>
For some reason, my count variable is always unregistered after I refresh or go back to the page later.
It appends the SID to the end of the link thats shown when you move the mouse over the 'next page' link, and this SID is always changing, shouldn't it be the same for the same user??
When I took office, only high energy physicists had ever heard of what is called the
Worldwide Web.... Now even my cat has its own page.
-Bill Clinton (1946 - ), announcement of Next Generation Internet initiative, 1996
<?php
session_start();
if (!session_is_registered('count')) {
session_register('count');
$count = 1;
} else {
$count++;
}
?>
<p>
Hello visitor, you have seen this page <?php echo $count; ?> times.
</p>
<p>
To continue, <a href="nextpage.php?<?php echo strip_tags(SID); ?>">click
here</a>.
</p>
For some reason, my count variable is always unregistered after I refresh or go back to the page later.
It appends the SID to the end of the link thats shown when you move the mouse over the 'next page' link, and this SID is always changing, shouldn't it be the same for the same user??
When I took office, only high energy physicists had ever heard of what is called the
Worldwide Web.... Now even my cat has its own page.
-Bill Clinton (1946 - ), announcement of Next Generation Internet initiative, 1996