| | |
Help with Last Activity Time
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Peace, I wrote a PHP File Contains a login form, If the user logs in a field will be inserted into the MySQL DataBase, So I want to make an automatic logout after 20 minutes idle.
I wrote:
I tried that and I encountered an error which does a logout to the user if he starts another hour.. Ex: Last_Activity= 59th Minute If he does a refresh in the 1st minute in the next hour it will logout, Who knows how to do that?
I wrote:
PHP Syntax (Toggle Plain Text)
<?php session_start(); require("Connecting_Config.php"); $unm=$_SESSION['user_name']; $current_date=date("i"); //Only Minutes $gt_lastactivity="select * from logs where Name='$unm'"; $do_gt_lastactivity=mysql_query($gt_lastactivity,$connect); $arr=mysql_fetch_array($do_gt_lastactivity); $last_activity_date=$arr['Last_Activity']; $yyy=$current_date-$last_activity; if ($yyy>20) { Logout(); } ?>
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
try cookies. that might help you. this example from O'Reilly's Learning PHP5 (free: chapter 8)
// The cookie expires one hour from now
setcookie('short-userid','ralph',time( ) + 60*60);
// The cookie expires one day from now
setcookie('longer-userid','ralph',time( ) + 60*60*24);
// The cookie expires at noon on October 1, 2006
setcookie('much-longer-userid','ralph',mktime(12,0,0,10,1,2006));
// The cookie expires one hour from now
setcookie('short-userid','ralph',time( ) + 60*60);
// The cookie expires one day from now
setcookie('longer-userid','ralph',time( ) + 60*60*24);
// The cookie expires at noon on October 1, 2006
setcookie('much-longer-userid','ralph',mktime(12,0,0,10,1,2006));
•
•
•
•
try cookies. that might help you.
The great scientist see his web-site:
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
http://www.elnaggarzr.com/en
I'm sure that will be good for you!
![]() |
Similar Threads
- Microsoft - sort it out (rant) (IT Professionals' Lounge)
- Help! software lifecycle Models (IT Professionals' Lounge)
- Need help with looping, pickling, data file (Python)
- How to capture the system idle time in c/c++ (C++)
- Date/Time of original post... (DaniWeb Community Feedback)
- Compiling Problems (C++)
- computers network 2 lose internet at same time (Networking Hardware Configuration)
- verify that a file was downloaded (save as was clicked) (ASP)
- "Run time error, do you wish to debug?" (Web Browsers)
Other Threads in the PHP Forum
- Previous Thread: Need Help Making a Form send to an email using PHP
- Next Thread: php header include on html? (picture gallery)
| Thread Tools | Search this Thread |
.htaccess apache api array autocomplete beginner binary body broken cakephp class cms code convert cron curl database dataentry date date/time display duplicates dynamic ebooks email emptydisplayvalue error execute explodefunction file firstoptioninphpdroplist folder form forms function functions google hack href htaccess html htmlspecialchars image include ip javasciptvalidation javascript joomla keywords limit link login mail matching mediawiki menu methods multiple mycodeisbad mysql network number object oop paypal pdf php phpincludeissue query random recursive redirect remote script search securephp server sessions shot source sp space speed sql subdomain subscription system table tag tutorial tutorials upload url validator variable vbulletin video web white youtube





