Bucketball

Bucketball

Flash Development

Bucketball is a flash game, in which the objective is to catch as many balls into the bucket in 60 seconds whilst avoiding the lightning bolts.


View More Information...

How to create simple Member Login for your websites. Part 2 - Session Management

How to create simple Member Login for your websites. Part 2 - Session Management

Part 2 - Managing Sessions

OK now we have the user logged in how do we keep them logged in while they are going between pages in the members area/admin area.

Simple all we need to do is include this small piece of code right at the first line of every page.

<?php
session_start();

// is the one accessing this page logged in or not?
if (!isset($_SESSION['admin_loggedin'])
|| $_SESSION['admin_loggedin'] !== true) {

// not logged in, move to login page
header('Location: index.php');
exit;
}

?>




Notice we start the session once again and check to see if they are logged in and kick them back to the index.php page if there not and if they are logged in we leave them to use the page they are viewing.

That's all there is to managing sessions.

Next Page - Logging out users

Back to the start

Comments

Comments will be displayed here

Back to Tutorial Home