There are many ways you could do this. The simplest way could possibly be for you to use sessions.
http://uk3.php.net/manual/en/ref.session.php
If you follow that link it gives you some information on what session are and how to use them.
An example of how you could implement it would be:
<?php
session_start();
// DATABASE CONNECTION & QUERY
// IF THE USER IS AUTHENTICATED THEN SET A SESSION
$_SESSION['authenticated_user'] = true;
?>
Whenever a user accesses a page you just need to run this code:
<?php
session_start();
if($_SESSION['authenticated_user']!=true){
header('Location: login.php');
die();
}
?>
If the user has been authenticated then they won't get re-directed.
Write back if you need further help.
If you've found this post useful please add to my reputation!