You sound new, here's an overview:
Page 1:
<?php
session_start();
if($someCondition==true){
$_SESSION[loggedIn]=true;
}
?>
Page 2:
<?php
session_start();
if($_SESSION[loggedIn]=true){
include('supersecretpage.php');
}else{
header('Location: login.php');
exit('You are not logged in');
}
?>
You need to read up on sessions and session variables in the php manual, this is the best way to go