Page 1 of 1

Counting new posts logically (confused myself)

Posted: Sat Oct 23, 2004 2:35 pm
by tony montana
Ok so basically when a user posts a new reply or views a thread then there last visit time is updated. However if I go on a diffrent browser then I still get the count of new posts - even if they are my own.

The query as it is;

Code: Select all

SELECT * 
				FROM $forumzDB.forumz_posts p 
				JOIN $forumzDB.forumz_threads t ON (p.tid = t.tid)
				JOIN $forumzDB.forumz_forums f ON (t.fid = f.fid) 
				WHERE p.time > ".$_COOKIEї'last_visit']." 
				AND f.level <= ".$user_properties&#1111;'status_id']."
				AND f.type != 'lock'
				AND p.uid != ".$user_properties&#1111;'uid']."
				ORDER BY p.time ASC
Ok so I ran this through phpmyadmin and it showed that the query was counting the posts in threads I was the last poster in - BUT all it wasnt doing was counting my own when really it should look and go `hey, your the last poster (AND p.uid != ".$user_properties['uid'].") and we dont count in that thread.

So Im confused how to incorporate that and the more I think about it the more I confuse myself, help :)

Posted: Sat Oct 23, 2004 4:48 pm
by kettle_drum
Many browsers dont share the cookies and so you wouldnt be able to get that value from the user. A better way would be to store the value for the user id and then when the user logs in - with any browser - it will have it correct. You just have to set the cookie for people who are not logged in, and they shouldnt expect the info to be stored as they havent identified themselfs to the site.