Hi,

I am trying to complete a registration script. There are certain pages which I want to redirect someone if they not logged in. Can anyone please advise how best to do this?


Code:
	 <?php
	     if ($_SESSION['userLoggedIn'])
		 
	
		 
{
  echo '<div class="loggedin">
' . $_SESSION['userfirstname'] . ' ' . $_SESSION['usersurname'] . ' <a href="/test/closesession.php">Logout</a> 
  </div>
  ';
} else { echo 
'<div class="headersignin">	
<a href="/users/login.php"   rel="nofollow" class="blacklink"   >
Sign in
</a>
</div>
<div class="headerjoin">
<a href="/users/register.php" rel="nofollow" class="whitelink"   >	Join free</a>
</div>';
}
?>