Sessions can be used as an alternative to cookies. Every page that makes use of sessions MUST begin with the following.
This file has that code at the top. If no session exists this commands starts one, if one is already started this command recalls values in this session such that they can be displayed via the $_SESSION global array.
We will see how sessions can be used to store login details. The following code creates a HTML login form.
A session ends when the browser window is closed. You can force the session to end, in order to clear data using unset().