The sessions on my website don’t seem to be destroyed as soon as the website is closed, I was wondering if this has anything to do with InfinityFree?
Oxy
June 5, 2023, 10:13pm
2
Hi and welcome to the forum
Please provide the URL of the website and more information.
Until then, maybe this will be of use to you:
Username: epiz_29888944
Url: kalle.rf.gd
Hi,
I have a login system on my website and have run into a problem. I use sessions to store the users data while the session is active. I have noticed that the PHPSESSID cookie lasts for about 24 hours and will not be destroyed when closing the browser.
Is there any way to change this behavior or do I have to find a different solution?
or the opposite
The __test cookie is not a session cookie. It’s a cookie set by our system and you cannot modify it. It doesn’t affect any other cookies you may have, including any PHP session cookies. A website can pretty much have as many cookies as you want. And a cookie with one name has no effects on a cookie with another name, they are completely separate.
The checks in initSession seem a bit irrelevant to me though. The session_start() function must always be called to start or resume a session. So you…
5 Likes
sibenm
June 5, 2023, 10:50pm
3
Ahh, figured it out with the help of this post.
Turns out InfinityFree sets the default timer for the ‘PHPSESSID’ cookie at 24 hours, and to change it you override the cookie using the session_set_cookie_params(); function and set the expiry timer to 0 causing it to destroy when the browser closes.
session_set_cookie_params(0);
6 Likes
system
Closed
June 12, 2023, 10:50pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.