Jump to content

PHP session's to bake perfect cookies


majocmatt

Recommended Posts

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?
Link to comment
https://forums.phpfreaks.com/topic/21316-php-sessions-to-bake-perfect-cookies/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.