Jump to content
Larry Ullman's Book Forums

Newbe To Php And Session Usage


Recommended Posts

Your book was a Great Find, thanks to your hard work, I am making great progress as well now...

 

My question is probably a simple one but here goes:

 

Are sessions relative to the server time connected? By that I mean, are they separated from all other users that may be using my website at the same time? Or do they overlap with all users and therefore do I have to establish an unique session set for each person who signs in to the site. I am hoping that the first choice is right (easier) and all I have to do is start every web page with:

 

<?PHP
ob_start();
isset($_SESSION) || session_start();

...

 

and the server assigns each user a unique id to keep all other sessions apart? ;) 

 

In the session_start() am I supposed to put something in-between the () such as my own set-name, or is that always empty? Does it allow for a parameter and if so what goes there?

 

Thanks in advance for any words of wisdom!!! 

Link to comment
Share on other sites

Hello, atljj, and welcome to the forums.

 

To answer your question, your first assumption is correct. The server automatically assigns a unique session ID to each user, thus keeping them all separate, even if they connect at the same time. That ID is stored in a cookie file on the user's local machine, so you don't have to worry about crossing anything up between users.

 

Also, session_start does not require any arguments, meaning that the parentheses are always empty.

Happy coding, and feel free to ask any other questions you may have.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...