I'm having an issue on my website I can't seem to troubleshoot. The site has a login that works fine, but the site sporadically logs users out.
Steps: 1. Login
Use site (usually won't log you out right away)
Click on link (The links vary, doesn't seem to be isolated to a specific one)
Get logged out
The site has a 60-90 minute timer that is supposed to log people out, but for some reason I keep getting booted 5-30 minutes in. I have an MySQL_error function that reports errors but it doesn't report an error being present (otherwise I would post it). This error has been present for quite a while and I can't figure out how to troubleshoot it very well at all. I would be very grateful for any assistance!
All of my pages use $_SESSION like so....
if(isset($_SESSION['user_id'])) { insert page coding here }
Else it logs you out. I have noted this abnormality on multiple computers and I don't think it's based on my computer settings.
I had a similar problem once (see php $_SESSION variables disappear and reappear randomly ). It acted as if session variables would disappear randomly, and sometimes they also reappeared after some time.
I was eventually able to fix that problem by activating strict mode for sessions, adding this line right at the top of the page, above session_start();
:
ini_set('session.use_strict_mode', 0);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.