Jump to content

PHP - checking online users


crashmaster

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.