<?php
session_start();

$loginScript="admin_login.php";

$notAuthenticated=!isset($_SESSION["authenticatedUser"]);
$notLoginIp=isset($_SESSION["loginIpAddress"]) && ($_SESSION["loginIpAddress"]!=$_SERVER["REMOTE_ADDR"]);

if($notAuthenticated)
{
	session_register("loginMessage");
	$_SESSION["loginMessage"]="To view this page, please login";
	header("Location:".$loginScript);
	exit;
}
else if($notLoginIp)
{
	session_register("loginMessage");
	$_SESSION["loginMessage"]="You have not been authorised to view URL".$_SERVER["REQUEST_URI"]."from the address".$_SERVER["REMOTE_ADDR"];
	header("Location:".$loginScript);
	exit;	


}else{
	//authenticated
	$auth_set=1;
}

?>