Simple Password Protect Page

A simple PHP password protection script for a single page. Your visitors must enter a password and username into a form to view the content of the page.

<?php
// Define your username and password
$username = "someuser";
$password = "somepassword";

if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {

?>
<h1>Login</h1>
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<label for="txtUsername">Username:</label>

<input type="text" title="Enter your Username" name="txtUsername" />

<label for="txtpassword">Password:</label>

<input type="password" title="Enter your password" name="txtPassword" />
<input type="submit" name="Submit" value="Login" />
</form>

<?php

}
else {

?>

This is the protected page. Your private content goes here.

<?php

}

?>
Faster REGEXP Search Faster MySql REGEXP LIKE Search
Movie Maker MP4 Movie Maker Import MP4 3GP
Movie Maker Profiles A selection of Movie Maker Profiles
Simple Password Protect Page A lite simple PHP password protect script
Develop Our Wordpress website development service
Projects Information on a small selection of our projects
Tips Some tips and ideas we would like to share
Wordpress Plugins and Functions for Wordpress Developers

Leave a response below




Name and email address required, website must be related
08445 008 009