This is your entire page! You just copy and past this on whatever page you want to be password protected, naming it whatever you want. Though, remember, the file name has to end in .php.
Copy and past this entire code:
<?php
include(“header.php”);// Define your username and password
$username = “username”;
$password = “password”;if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {
?>
To log in, fill out this form:
<p><form name=”form” method=”post” action=”<?php echo $_SERVER['PHP_SELF']; ?>”>
<p><label for=”txtUsername”>Username:</label>
<br /><input type=”text” title=”Enter your Username” name=”txtUsername” /></p><p><label for=”txtpassword”>Password:</label>
<br /><input type=”password” title=”Enter your password” name=”txtPassword” /></p><p><input type=”submit” name=”Submit” value=”Login” /></p>
</form></p>
<?php
}
else {?>
THIS IS THE PASSWORD PROTECTED PAGE THAT THE USERNAME AND PASSWORD WILL LEAD TO ONCE ENTERED AND CORRECT.
<?php
}
include(“footer.php”);
?>
You add your username and password by changing these variables to whatever you want them to be:
$username = “username”;
$password = “password”;
Also, before the actual sign in form, you are welcome to add anything that you want, as well as after it.
Page Views: 138 views





















