Can anybody give me an example or a resource about this?

well, thanks for the link, but thats not what I was looking for. I was looking for SID’s that you use in links.

well that gives you a good example of using session variables. What exactly do you want to use session variables for?

I know how to work with session variables. I wanted to use session id’s to keep track of a user surfing the website, for instance, how many times has that user viewed that page and so on.

you can do all the stuff you mentioned without having to worry about the session id’s generated by php really…

and how would i do that…?

if you want to count unique hits on a certain page, or even a site, you could register a session variable that indicates whether it’s the user’s first visit to the page or not, and incrementing the counter based on that, therefore counting unique hits. Look at the code:



if ( !isset( $_SESSION['visited'] ) ) // if the variable 'visited' has not been set
$_SESSION['visited'] = 1; // register the session variable 'visited'

increment counter here, be it mysql, xml, flat file, etc..


// ...

Using that, you know you’re adding 1 to the counter only once per user session :slight_smile:

oh man, y couldn’t i think of that!. Oh well, thanks a lot! I appreciate it

haha, simple ain’t it :stuck_out_tongue:

it sure was :slight_smile: