run php when closing browser window?
Posted 04 August 2006 - 01:37 PM
I am creating a login component which stores a simple Y/N value in a MySQL database depending on if the login was successful or not. I need to somehow reset this to N when the user closes the browser window. What would be the best way to achieve this with PHP? I can create the sql statement, but how would I go about running a function when the window is closed?
Thank you for your time.
Posted 04 August 2006 - 01:40 PM
The best way to find out who is online is
add a field into the DB, last_action or something, as DATETIME field
On the top of every page, have a script
If the user is logged in,
Update the table with last action of that date time
Anyone who has action within the last 10 minutes you can assume they are online
Posted 04 August 2006 - 02:01 PM
Posted 04 August 2006 - 04:27 PM
Project Manager - Jeevansathi.com
7 yrs. exp. in LAMP
Certified Mysql DBA
Zend Certified Engineer
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users