Click to See Complete Forum and Search --> : cookies/sessions


tinernet
10-10-2003, 07:50 AM
im making a game that is just based in the browser, but i need to call the values from a mysql table each time they click everythin. however as there will be multiple usernames all with different stats i need a way to track who is logged in or the game will just be pointless. i started makin the game in flash so this isnt a problem but i found that php and js is easier and more compatible. any ideas?

pyro
10-10-2003, 08:29 AM
Just make another MySQL table that contains which users are currently logged in. You'll need to keep track of the timestamp when they were last active, so you can remove them from the table if they are inactive for a set amout of time. When I needed to do this, I logged their IP with a timestamp, and then would check if the IP existed, and if so, just updated the timestamp, but if not, add a new row. Also make sure you itterate through the table each time to check for old timestamps that need to be removed.