Prova così, questo è quello che uso regolarmente per gli accessi proprietari ad aree riservate.
Comprende anche la gestione dell'errore.
Pagina login.php:
	Codice PHP:
	
<form name="access" action="autentify.php" method="post">
        <table border="0" style="width:400px;" cellpadding="0" cellspacing="0">
        <tr>
            <th>Username</th>
            <td><input type="text" name="username" style="color:#999;"  class="login-inp" /></td>
        </tr>
        <tr>
            <th>Password</th>
            <td><input type="password"  name="password" style="color:#999"  class="login-inp" /></td>
        </tr>
        <tr>
            <th></th>
            <td valign="top"><?PHP if(isset($_GET['errn'])){ if($_GET['errn'] == "noaccess"){?><font color="#AA0000">Impossibile effettuare l'accesso.</font><?PHP }  if($_GET['errn'] == "nosession"){?><font color="#AA0000">Tempo di inattivitá superato.
Per motivi di sicurezza rieseguire il login.</font> <?PHP } if($_GET['errn'] == "exitsuccess"){?><font color="#004400">Disconnessione eseguita.</font> <?PHP } } ?></td>
        </tr>
        <tr>
            <th></th>
            <td><input type="submit" class="submit-login" value=" "  /></td>
        </tr>
        </table>
        </form>
 
Pagina autentify.php
	Codice PHP:
	
<?PHP
    $Username = $_POST['username'];
    $Password = $_POST['password'];
    
    if(($Username == "xxxxx") && ($Password == "xxx"))
     {
        session_start();
        $_SESSION['ACCESS'] = "OK"; 
               
                //PAGINA DI LANDING IN CASO DI USERNAME E PASS CORRETTI
        header("location:start.php");    
     }
     
     else
     {
                
                 //PAGINA DI LANDING IN CASO DI USERNAME E PASS SCORRETTI
         header("location:login.php?errn=noaccess");
     }
?>