smerny Posted August 3, 2009 Share Posted August 3, 2009 How do forums like these keep track of guest users? Do they get an ID in a database with a matching session ID? or what? same database as the users database? or separate? Link to comment https://forums.phpfreaks.com/topic/168696-keeping-track-of-guest-users/ Share on other sites More sharing options...
gevans Posted August 3, 2009 Share Posted August 3, 2009 I'd imagine they use a table listing the people viewing the forum, if they are logged in an online flag is marked, otherwise they are considered a guest, updated everytime they do something, if not actiuve in the last 10 minutes (example) they get deleted, stored by ip. Link to comment https://forums.phpfreaks.com/topic/168696-keeping-track-of-guest-users/#findComment-889989 Share on other sites More sharing options...
jonsjava Posted August 3, 2009 Share Posted August 3, 2009 if you want to store it as a database id, you can create a table named GUEST with a schema like this: id INT(5) NOT NULL autoincrement SID VARCHAR(32) NOT NULL and have a script in your header with something like this <?php //pseudo-code session_start(); if (!$_SESSION['user']){ $guest_session = session_id(); //store it to the database. check for old sessions that have expired, etc. } else{ //they are a member } this is the ugly version. I figured I'd let you flesh it out. Link to comment https://forums.phpfreaks.com/topic/168696-keeping-track-of-guest-users/#findComment-889999 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.