in a nutshell: login.php <?php session_start(); function hhb_tohtml($str) { return htmlentities($str, ENT_QUOTES | ENT_HTML401 | ENT_SUBSTITUTE | ENT_DISALLOWED, ‘UTF-8’, true); } $accounts=array( //username =>password ‘smith’=>’smell’, ‘admin’=>’password’, ‘guest’=>’guestpass’ ); if(array_key_exists(‘submit’,$_POST)){ if(!array_key_exists(‘username’,$_POST)){ $username=””; } else { $username=$_POST[‘username’]; } if(!array_key_exists(‘password’,$_POST)){ $password=”; }else { $password=$_POST[‘password’]; } if(!array_key_exists($username,$accounts)){ die(‘This username does not exist.’); } if($accounts[$username]!==$password){ die(‘wrong password!’); } $_SESSION[‘logged_in’]=true; $_SESSION[‘username’]=$username; … Read more