You will want to use $_SESSION
,
On access.php
session_start();
// some code here to authenticate
$_SESSION['hasAccess'] = true;
// redirect
Change contacts.html
to contacts.php
and at the top of this page
session_start();
if($_SESSION['hasAccess'] !== true){
header('Location: index.php');
die;
}
// the rest of your code