[an error occurred while processing this directive]

14.3: Sessions

How long does a cookie exist?

What is a session?

How sessions are established

session

Cookies vs. sessions

cookie monster

Sessions in PHP: session_start

session_start();

Accessing session data

$_SESSION["name"] = value;        # store session data
$variable = $_SESSION["name"];     # read session data
if (isset($_SESSION["name"])) {  # check for session data
if (isset($_SESSION["points"])) {
	$points = $_SESSION["points"];
	print("You've earned $points points.\n");
} else {
	$_SESSION["points"] = 0;  # default
}

Where is session data stored?

session cookie

Session timeout

Ending a session

session_destroy();

Common session bugs

Practice problem: Power Animal

power animal
power animal

Implementing user logins

user login

"Remember Me" feature

user login
[an error occurred while processing this directive]