|
-
Aug 23rd, 2005, 03:16 AM
#1
Login time/expire
To keep track of the time a user logs in I created a field in the DB called LoginTime (Type : timestamp(10)). So when someone logs in, I use this :
PHP Code:
$sql = "UPDATE `users` SET `LoginTime`=NOW() WHERE `ID`=$id LIMIT 1 ;";
to set the time. Then, if I want to compare the time now with the time logged in, I get an error here :
PHP Code:
if ($row['LoginTime']+15 < NOW()){
So instead of NOW(), can I use time? Or maybe somehow format time to compare the two?
Thanks
Has someone helped you? Then you can Rate their helpful post. 
-
Aug 23rd, 2005, 08:11 AM
#2
Re: Login time/expire
I don't believe there is a Now() function in PHP. Use Time() instead. HTH
-
Aug 23rd, 2005, 09:21 AM
#3
-
Aug 23rd, 2005, 11:17 AM
#4
<?="Moderator"?>
Re: Login time/expire
why dont you only select the dates that are before/after a certain time?
Code:
SELECT * from table WHERE DATE_SUB(now(), interval 5 minute) >= time
-
Aug 23rd, 2005, 03:00 PM
#5
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|