| | | | Password Protection | | | Times viewed: 18122 Rating: 4/10 |
|
If you want to password protect a file, then you can use this:
<form name="pp" method="post" action="check.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 check.php
So in check.php we have the following:
<?php if ($_POST['pass'] == "PasswordHere") { include ("welcome.php"); } else { header("Location: error.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 check.php but actually load inside it welcome.php If its wrong it will redirect them to error.php
Author: Ice Tutorials
| Times viewed: 18122 Rating: 4/10 |
|
More PHP Programming - Scripts Tutorials:
- PHP Contact Form
|
|