Auto logout

Links for php scripts

Moderators: macek, egami, gesf

kiwi
New php-forum User
New php-forum User
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am
Contact:

Auto logout

Postby kiwi » Tue Jul 27, 2004 7:17 am

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

User avatar
Dabear
New php-forum User
New php-forum User
Posts: 24
Joined: Thu Jul 22, 2004 12:48 pm
Location: Norway
Contact:

Postby Dabear » Tue Jul 27, 2004 7:39 am

Code: Select all

<?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";
?>

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Tue Jul 27, 2004 7:40 am

If you're using sessions, just set the session to expire after the given time. Same for cookies.

kiwi
New php-forum User
New php-forum User
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am
Contact:

Postby kiwi » Tue Jul 27, 2004 10:06 am

where should i put the code? do i need to put in every pages? or in the login pages only? where should i put?

kiwi
New php-forum User
New php-forum User
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am
Contact:

Postby kiwi » Tue Jul 27, 2004 11:21 am

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

User avatar
Dabear
New php-forum User
New php-forum User
Posts: 24
Joined: Thu Jul 22, 2004 12:48 pm
Location: Norway
Contact:

Postby Dabear » Tue Jul 27, 2004 11:45 am

...and did you refresh the site ?

kiwi
New php-forum User
New php-forum User
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am
Contact:

Postby kiwi » Tue Jul 27, 2004 12:18 pm

i refresh it, and i'm still member also, by the way it should log out , so how?

kiwi
New php-forum User
New php-forum User
Posts: 124
Joined: Sun Feb 29, 2004 6:26 am
Contact:

Postby kiwi » Tue Jul 27, 2004 12:38 pm

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


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests

cron