/    Sign up×
Community /Pin to ProfileBookmark

SESSION control

I basically use session to hold my variables and data transfer from one page to another. I want to know how I can set time for a particular session for it to hold a variable and then empty it in a very little period like 20 seconds. For instance, a session like $_SESSION[‘auth’][‘error’] = “Invalid login”; displaying on a login page if(!empty), I want the session to empty after 20 seconds of seting the session.

Thanks in advance.

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@legendxDec 18.2006 — you want cookies for thier ability to set an expire time.
Copy linkTweet thisAlerts:
@NogDogDec 18.2006 — Before the session_start() on each page, add the following line:
[code=php]
<?php
session_set_cookie_params(20);
session_start();
[/code]

PS: Or, if you want to apply the cookie lifetime globally, set the desired value for [url=http://us3.php.net/manual/en/ref.session.php#ini.session.cookie-lifetime]session.cookie_lifetime[/url] in php.ini or in a .htaccess file.
Copy linkTweet thisAlerts:
@itbeingsauthorDec 18.2006 — Thanks but I think this will affect, all session. I wouldn't want to do that because am using the session to hold other values. I wan to be really specific in my session param.
×

Success!

Help @itbeings 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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