Kitu Posted December 30, 2006 Share Posted December 30, 2006 Hi,I have a small forum on my website, what I started to recode reacently. It is a fairly simple script and I would like to add few functions to it, one of which would be the new posts system. Problem is, that I have absolutly no idea how to do it...all I know is, that it has something to do with cookies? I would appritiate any help...I don't even know what to google to find any appropriate tutorials. Quote Link to comment Share on other sites More sharing options...
onlyican Posted December 30, 2006 Share Posted December 30, 2006 Its not done by cookies, I know that, because I delete my cookies daily, and it still shows New PostsI will do this, a bit complex, but a nice resultFirst have a table, with TrackerID INT(11) auto_increment,UserID INT(11),PostID INT(11),LastViewed DateTime,Primary Key (TrackerID)ThenEverytime a User views a postFirstCheck the table, to see if that user has seen itSomething likeSELECT * FROM Tracker WHERE UserID = '".$UserID."' AND PostID = '".$PostID."'";If there is a result, Update that row, to have LastViewed to be NOWElse, INSERT into the table.So know you know when the user last viewed the post.Then when displaying all of the topicsget the Last Updated Time (Last post)then run a query against the tracker to see if the LastUpdate is Before or After the User last viewed the PostIf its before, he has seen itIf its after, its NEW Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.