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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.