I modified it to this:
<?php
session_start();
$thispage=$_SERVER["SCRIPT_NAME"];
if ($_POST["pass"]!='') {
if (trim($_POST["pass"]) == 'freedom') {
//login is good
$_SESSION['level'] = 'ok';
}
}
// ask for login
if($_SESSION['level'] != 'ok') {
print "<form method=\"post\" action=\"".$thispage."\"><input type=\"password\" name=\"pass\" /><input type=\"submit\" value=\"Login\"/></form>";
exit();
}
?>
although working, it gives me this before the login box:
Notice: Undefined index: pass in d:\Domains\example.com\wwwroot\example.php on line 5
Notice: Undefined index: level in d:\Domains\example.com\wwwroot\example.php on line 12