Jump to content

check if Sessions are connected (from other PC's)


DarrenReeder

Recommended Posts

Im trying to make a 'online people' thing on my site that sees who is logged in on the site..i asume i do this by checking which sessions are started and making sure that the name of that sessions is a username in my database..so i need to know how i check all the sessions thats connected to the host

Hello,

 

Well I am guessing that you have a mysql database with a table called users or something close to that where you store the users info like username password email ect... ect...

 

well you need to add another row in that table called "online"

 

then you need to edit your login code to UPDATE "1" into the row called "online"

 

"1" will stand for online and "2" will stand for offline

 

so then you use mysql to ('SELECT * FROM tablename WHERE online="1"')

 

and on the logout code you need to use "UPDATE" mysql to update "2"  not insert "2" into the database

 

and on register page you need to insert "2" as a default unless your site auto logs the user in after registering then set it to "1"

 

-John

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.