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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.