Auto logout

A

Anonymous

Guest
I doing a web site, i need to do this feature, if a user already log in the web site, if the user didnt do anything in certain time, i want to make the user auto log out, this is for security purpose, how to implement auto log out in a certain time? can some one help me? thanks
 
Code:
<?php

/* set the cache limiter to 'private' */

session_cache_limiter('private');
$cache_limiter = session_cache_limiter();

/* set the cache expire to 30 minutes */
session_cache_expire(30);
$cache_expire = session_cache_expire();

/* start the session */

session_start();

echo "The cache limiter is now set to $cache_limiter<br />";
echo "The cached session pages expire after $cache_expire minutes";
?>
 
If you're using sessions, just set the session to expire after the given time. Same for cookies.
 
where should i put the code? do i need to put in every pages? or in the login pages only? where should i put?
 
i had try the code, but it didnt work, i used session to register after log in, then i do nothing wait for one minute (set to one minute). after that, i'm still a member. It sould be log out already after a minute, but it not happen, so how? what is the problem here? help me, thanks
 
i refresh it, and i'm still member also, by the way it should log out , so how?
 
what i want is, if the user didnt do anything (inactivity) then the user will be auto log out by the system. I mean is the user didnt do anything at all after log in in certain time, the the user will be auto log out, help me, thanks
 
Back
Top