PHP session variables problem

Status
Not open for further replies.

wagnj1

Solid State Member
Messages
13
Hello! 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
if (!session_is_registered('count')) {
session_register('count');
$count = 1;
} else {
$count++;
}
?>




Hello visitor, you have seen this page <?php echo $count; ?> times.
</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??
 
And its not the fact that I'm missing the session_start(); in the above code.
 
try adding:
session['count'] = $count;
and use that to determine wether the page has been viewed before, personllay i think "If they wanna save info, they can have it on their own PC" so im not much of a session man, gl
 
Status
Not open for further replies.
Back
Top Bottom