forum... checking for new post since last visit.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
b0bby
Forum Newbie
Posts: 1
Joined: Wed Sep 29, 2004 6:04 pm

forum... checking for new post since last visit.

Post by b0bby »

Hi, im building a custom forum
I have having trouble deciding what posts are new since the users last visit.

I can do it initially as they have a last visittime.. this is updated every time they visit a page on the site.

so im basically listing the posts that were added after the last visit date... easy enuff.
but once the page is refreshed.. the list is emptied as their visit time will have been updated...

i have though of a way of doing it with a seperated user_viewed table.
for posts.
listing post id's and who has viewed them

but i would like to avoid this as it could cause delays with the database if it was to get large.

VB and PHPbb do this thing very well... i cannot figure out how they do it.

Any ideas suggestions would be much appreciated
Thanks
Rob
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

1. A cookie is set each visit with a timestamp
2. When viewing threads it will check the timestamp of each post to see if it is greater then the cookie
3. If it is show that is has a new post


pretty simple
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

the simplest solution is combine a cookie and set a timestamp to it and compare n contrast the timestamp value to whatever u want

edit - beaten to it
Post Reply