I have a class based user session system. it uses the default session handling, a database of users and stores an object in the session.
It's worked for years, with occasional improvements. I have used it on a recent site that has survived 2 full OS and PHP/MySQL upgrades and stayed working.
I uploaded it to the webhost (not named), but now I have my sessions randomly failing.
Symptons are...
User logs in. OK
User browses private area OK
Randomly user is informed they need to log in. NOT OK.
User attempts to log back in but
- 50% of the time they already are still logged in.
- 50% of the time they get the log in box
WTF?
I found that this happens randomly, sometimes it doesn't happen for hours of testing and debugging, other times it happens everyother click within the authentication controled area. It happens at any point within the area, not any particular point.
Constantly refreshing a page every 10 seconds, results in a random order of..
- the apropriate page.
- the invite to log in.
- the log in box
"only" clicking refresh, nothing else.
I don't know where to begin to debug something so random, when the site worked on 2 previous servers and the code in the session/user handling has been in use on many more!
The only differences I have had to battle with are the new hosts restrictions for uploads, memory limits and max execution time.... and register_globals was off, but my site was designed for on.
(spare me the register_globals lecture, I know it well)
I enabled register_globals within .htaccess with a PHPFlag line and the site worked, except the sessions. Would this be related?
I'd love some help here.
I can post any code you need etc. Server details can be found here:
http://www.iceniproperties.com/phpinfo.php