ok...

in questa pagina controlla se la password inserita dall'utente è corretta, e se lo è crea un cookie:

Codice PHP:
<?php
 
if ($password == "pass") {
  
setcookie("cookieaccesso",$password,"/");
  
header("Location: x_home.php"); 
} else {
  
header("Location: index.php");
}
?>

Se la password inserita è giusta carica la pagina x_home.php, che controlla l'esistenza del cookie e il suo contenuto:

Codice PHP:
<?php
 
if (empty($cookieaccesso)) {
 
# nessun cookie
 
header("Location: index.php");
 exit;
 } else {
 
# cookie trovato ma contiene la psw giusta??
   
if ($cookieaccesso != "pass") {
   
header("Location: index.php");
   exit;
   }
 }
?>
<html>
 <body>
   pagina protetta
 </body>
</HTML>