This is a script using cookies for password.....running it on localhost it show the notice
undefined index:user
undefined index:pass
The code is as follows:
<html>
<body>
<form action="<?php echo ($self); ?>" method="post">
Please enter your details for access :<br>
Name:<input type="text" name="user" size="10">
Password:<input type="text" name="pass" size="10"><br><br>
<input type="submit" value="Log in">
</form>
</body>
</html>
<?php
$user=$_POST['user'];
$pass=$_POST['pass'];
$self=$_SERVER['PHP_SELF'];
if(($user!=null)and ($pass!=null))
{
if($pass=="mypassword")
{
setcookie("checkpass","okkay");
header("Location:loggedin.php");
exit();
}
else
{
setcookie("checkpass");
}
}
?>