I have an intermittent problem with my sign-in/registration system in that some users find that they have to sign in twice. They go to the sign in page, enter their details and rather than being redirected to their own page, have to sign in again.
The sign in process uses sessions and I've monitored what is happening. The session gets passed happily from one page to the next for most users and stays intact when they sign in. All works well.
However, for other users, when they try (and fail) to sign in, the old session gets destroyed and a new one is created. And then they can sign in.
I don't think there's anything unusual in my code and there's no consistency in the platform/browser combination which experiences the problem - except that it is the same people each time who are experiencing it.
This has had me stumped for some time so any suggestions welcome!
The code. Each page starts with:
session_start();
and when a user has signed in I set their data like so:
$_SESSION['name'] = 'Name';
etc. The only time a session_destroy() is used is when the user deliberately clicks on the 'Sign out' link.