Hello everyone, I just started learning PHP last week, and now I have a problem.
I'm building an online quiz website with user login function. When a user login by entering correct username&password, he/she will be redirected to the page where quiz starts.
Meanwhile, the user's id and username will be stored into two session variables. They are to be used later when other pages shows user information and display the results.
Currently I'm testing the website using Apache on localhost. On every page that needs the session variable, I called <?php session_start() ?> in the beginning.
The problem is:
When I open IE window and login with user1, everything is fine. However, when I open another window and login with user2, it seems that the session variables originally storing user1's information are overriden with user2's information, therefore causing a mess on user1's page.
My questions are:
- I used echo to check user1 and user2's session ids, and they are the same. Is there only one session allowed to exist? If not, how can I start one session for each user?
- How can I avoid session variables being overriden?
Thanks a lot in advance 🙂