Using PHP Session Variables?

Codeman

New member
What is a basic php code to check if the session variable Y is true and if the value = this X? And if the value is a password is it secure? how do i remove all session variables from my site? Thanks in Advance.
Can you define multiply session variables?
Is having a session variable named 'loggedOn' and a value 'true', is this a good way to tell if a user is logged on?
 
A PHP session solves this problem by allowing you to store user information on the server for later use (i.e. username, shopping cart items, etc). However, this session information is temporary and is usually deleted very quickly after the user has left the website that uses sessions.

It is important to ponder if the sessions' temporary storage is applicable to your website. If you require a more permanent storage you will need to find another solution, like a MySQL database.

Sessions work by creating a unique identification(UID) number for each visitor and storing variables based on this ID. This helps to prevent two users' data from getting confused with one another when visiting the same webpage.

if u want to destroy only one session variable, u can use this

unset($_SESSION['variable_name]);

if u want to destroy all the session variables u an use this,

session_destroy();
 
Back
Top