PHP Sessions…

Using $_SESSIONS… Forgot the syntax… Here-ya-go.

Initialize Session
This must be at the top of every page that will call/use a Session variable.
php session_start();

Register (declare) a Session variable
To add a Session variable that will be carried till the browser is closed or you kill it yourself.

Assigning value to a Session variable
Values added to a Session variable can be letters (ABCabc), numbers (1, 200, 999.99, etc.) making them good for usernames/userID’s when logged into a site.
$_SESSION[“mySessionVariable”] = “MEMBER”;

Unregister a Session variable
Logging out requires we unregister any and all Session variables used for our application and the users’ account.

Destroy a Session
We should always destroy a Session to help complete a logout.

Leave a Reply