Insurance Quotes - Find jobs - Wordpress Themes - Property in Estonia - Find jobs

PDA

View Full Version : php help


kumar84
Jul 4th 2007, 10:37 pm
hai

I have login page with the help of username and password Iam entering into my login ,
After entering into my login I want to rename my files
While entering into my login I have a field named lock in my database which is set to 1
After I signout it will SET TO 0

That's what i have done

Now i need is without renaming my files iam in my login for more than 2 minutes means THE lock in the database need to be set to 0 automatically

for that i need php code

Greg Carnegie
Jul 5th 2007, 2:35 am
To do so you will need another field in your table, let's call it:
last_activity DATETIME

Whenever page is loaded you should run such query:

UPDATE table_name SET lock = 0 WHERE last_activity > DATE_SUB(now(), 2 MINUTES)

I didn't tested it if won't work then do a search on DATEDIFF() function.