For my forum i need to have some sort of tracking to show which topics are new since the users last visit and which ones have replies. This has been something I have been putting off since Im not too sure how to go about it.

When a user logs in their active time is saved to the database, so its easy enough to get the topics that are new since their last visit. But how would those topics be marked as read when a user views them? Any ideas?