Jump to content


Photo

PHP session's to bake perfect cookies


  • Please log in to reply
No replies to this topic

#1 majocmatt

majocmatt
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 19 September 2006 - 08:32 PM

I'm curious to learn how sites, such as this one, track users so precisely.

I have a web site that has a large amount of registered users, and most of these users set their login information to be 'remembered' at initial login time.

I would like to show users what is new since their last visit, and also, when they surf through the different pages and come back to the 'Whats New' module on the front page, everything isn't gone, just what they have viewed during that session.

Now, I think I have a solution to part of this problem I'm facing.

Since user's are theoritcally always logged in (remember-me cookie), I think I would just have atop every page a: if -> is not set -> session -> send a query to the database and update the last_viewed field for the user with this instanced timestamp.

Then I would compare that time to all the different entities my web site displays (blog, photos, etc) and show what is new.

Is this sufficient?

The second part of the problem, I do not understand well. How do I then track, only during the current session, what has been viewed from the 'whats new' list?

Is this best accomplished via sessions paired with cookies?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users