Tutorial Guide
    Tutorial Man
    3D Resources
    3D Tutorials

Password Protection

Social Bookmarks   Add to Del.icio.us   Add to Digg   Submit to Reddit   Stumble It!   Blink & Share     Share on Share on Technorati   Share on Facebook
Times viewed: 25806   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
Times viewed: 25806   Rating: 4/10
Social Bookmarks   Add to Del.icio.us   Add to Digg   Submit to Reddit   Stumble It!   Blink & Share     Share on Share on Technorati   Share on Facebook
More PHP Programming - Scripts Tutorials:
- PHP Contact Form