Want to password protect a portion of your website?
<form name="pp" method="post" action="checkpass.php">
<input type="password" name="pass">
<input type="submit" value="Log In">
</form>
Ok we have a form and an input, called pass.
When they click Log In it will take them to checkpass.php
So in checkpass.php we have the following:
<?php
if ($_POST['pass'] == "PasswordHere") {
include ("protected.php");
}
else {
header("Location: notright.php");
}
?>
So this is an if and else statement, replace PasswordHere with the password you want to use!
If the password in the form and your password match then it will keep checkpass.php but actually load inside it protected.php
If its wrong it will redirect them to notright.php