Maintaining Sessions in PHP
Scripts & Programming February 15th, 2007Sessions are important when you need to store user specific data when the user is navigating from page to page. For example, think of a shopping cart or a secured page. Each time that the use clicks on a link and navigates to a different page, you do not want the shopping cart to empty itself. In these cases, the user session needs to be preserved.
PHP maintains sessions by default. This is done by appending a PHPSESSID variable to all urls where it is not explicitly set. This session id is usually a non human understand-able string which gets passed from page to page. Though session id’s are a nice way to maintain sessions, it may be to your disadvantage when you do not need them. PHPSESSID’s make your web page urls ungainly and some search engines are known not to spider them very well. This SEO blog has a lot of information on this and similar topics that you may be interested in. It also talks about how you can disable PHPSESSID’s when you do not need them.
If you are looking for more information on maintaining sessions using the PHPSESSID feature then visit the PHP manual page. You will find descriptions of the API’s required as well as some examples to implement sessions on your website.
June 12th, 2007 at 12:26 pm
Very Informative