/    Sign up×
Community /Pin to ProfileBookmark

How do you set a session time limit?

How could i set a time limit of 30 mins that locks the user out of the screen?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYMar 28.2006 — set a cookie to expire 30 minutes later
Copy linkTweet thisAlerts:
@WebnerdMar 28.2006 — Or you can do a wacky IP store. When the page loads, save their IP as a flat file:
[code=php]
<?

$timelimit=30;

$ip=$_SERVER["REMOTE_ADDR"];

$file="data/$ip";

if(!is_dir("data")) mkdir("data");

if(file_exists($file)){
if(filemtime($file) < time()-($timelimit*60)){
unlink($file);
}else{
die("You cannot enter.");
}
}else{
touch($file);
}

?>
[/code]
×

Success!

Help @peteyb spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.3,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...