PHP sessions are used to store user information and pass that information to a group of pages. But where is the session information stored, on the user computer or the web server? Suppose I logged into a site. Now that site has my information stored in session. If another user logs in from another computer with his own username, does his information gets stored in a session and mine is removed or is there a array of sessions? I just dont understand the idea of session. If you didnt get what I am asking, we have same session variable for everyone. like $_SESSION['username'] is used for everyone in a site. If I log in my username is stored in that variable. If another user logs in, does his username replaces mine or is there a sort of array which stores all usernames. Hope you understood what I am asking. Any help would be appreciated.
On the Server. Session is something which is one to one. That means if 2 people connect using the 2 different locations 2 sessions runs in the server.
Thanks Shabbir for your reply. I researched some more about sessions and found out about session id. I got the idea. I am trying to make a chat script using php, ajax and mysql. If I use sessions for storing information how will I show who's online in a chat room? Is there a way to display all active sessions. Another way is storing online users' information in database. I can keep a logout button which would remove the user's record from database, but if the user closes the browser instead of logout button, then the record wont be deleted from table and he won't be able to log in again. Help me find a solution.
No you need to have them into the database and then display it because displaying the sessionid can be a security flaw as well as of no use.