/    Sign up×
Community /Pin to ProfileBookmark

I’ve been using session_set_cookie_params() to establish the lifetime of the session cookie on my site. How exactly do I set the lifetime of a session to where it won’t expire as long as the user is active on the site?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 20.2009 — Define "active on the site", remembering that HTTP is a "stateless" protocol. In other words, how do you know the user is on your site versus watching a YouTube video in another tab of his browser?

In any case, the most typical setting (and PHP's default) is to set the cookie time to zero, which is then interpreted as "until the browser is closed."
Copy linkTweet thisAlerts:
@Joseph_WitchardauthorAug 21.2009 — What I mean is, from what I've always gathered from vBulletin, is that it's able to tell that you're doing something on the forum, and if you're not for a certain amount of time, then it logs you out. Is that not the case? Like on this forum, I get logged out pretty quick if I just leave my computer sitting here. But I've never had that happen as long as I'm posting and using the forum. Has that just been luck?
×

Success!

Help @Joseph_Witchard 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.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

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