billmalarky
billmalarky

Reputation: 950

Keeping php sessions after browser is closed

I've noticed that when I use tumblr, I never have to log in (unless I have explicitly logged out beforehand). Even if I have closed my browser, shut down my computer, not visited tumblr in like a month if I visit tumblr.com I find that I am still logged in.

How are they accomplishing this? Just setting session_set_cookie_params for like a month or something?

Upvotes: 2

Views: 2074

Answers (2)

Blake K Peterson
Blake K Peterson

Reputation: 481

They are doing this with a cookie. Clear your cookies and you have to log in again.

Upvotes: 0

donutdan4114
donutdan4114

Reputation: 1272

They use a cookie, with an expire time in the future.

setcookie('username','bob',time()+3600*24*7);

That would create the username cookie for 7 days. Notice that if you clear your cookies, you will become logged out of all websites.

Upvotes: 2

Related Questions