Introduction

The HTTP protocol has no built-in way of maintaining state between two transactions. When a user requests one page, followed by another, HTTP does not provide a way for you to tell that both requests came from the same user.

The idea of session control is to be able to track a user during a single session on a Web site. If you can do this, you can easily support logging in a user and showing content according to the authorization level or personal preferences. You can track the user's behavior, and implement shopping carts.

The difference between a cookie and a session is that a cookies stores the data on the client side, whereas a session store the data on the server.

Sessions have more benefits than cookies:


Sessions in PHP | Introduction | Basic Session Functionality | Creating a Session | Accessing Session Variables | Deleting a Session | Implementing a Login System with Sessions | Saving Arrays in a Session | Using Cookies with Session | Sessions without Cookies | Potential Session Problems
© 2008: Hann So
email: hso@voyager.deanza.edu