crashmaster Posted December 19, 2007 Share Posted December 19, 2007 Hi there, I am programming my web, where web is based on the user system (profiles, private messages etc.) But i have 1 problem. I dont know the main idea, how can I check if the user is offline or online. Auth system based on the sessions, mysql, and cookies. When user is loggin in: 1)Checking username, and password (comparing with database) (SELECT username,user_id FROM users WHERE username='$username' AND password = 'md5($password)' <- this is the main query) 2) If mysql_num_rows > 0 : a. setting $_SESSION['auth'] = 'logged'; $_SESSION['username'] = $z['username']; b. INSERT INTO sessions VALUES (session_id(),$_SESSION['username']) ; c. setcookie('SESSION', session_id(), time() + 60*60*24*21); 3) Also I included on the index.php function check_auth(); which checks COOKIES, if cookies found -> comparing with database table sessions -> if mysql_num_row > 0 : setting $_SESSION (like on the logining) This is main idea... But I dont know how to develop Online system, based on mine existed AUTH system... Have anyone any idea ? Thanks, crashmaster btw my web: www.jednanoc.magistri.biz (u can critique it also )) Link to comment https://forums.phpfreaks.com/topic/82379-php-checking-online-users/ Share on other sites More sharing options...
papaface Posted December 19, 2007 Share Posted December 19, 2007 Everytime they do an action log it. If their last action was X minutes ago = offline. Link to comment https://forums.phpfreaks.com/topic/82379-php-checking-online-users/#findComment-418792 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.