Skip to content

Instantly share code, notes, and snippets.

@jffkka
Created May 30, 2010 17:00
Show Gist options
  • Save jffkka/419163 to your computer and use it in GitHub Desktop.
Save jffkka/419163 to your computer and use it in GitHub Desktop.
<?php
// Define your username and password
$username = "USERNAME HERE";
$password = "PASSWORD HERE";
if ($_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {
?>
<h1>Login</h1>
You must login to see this private content.<br>
<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>
<?php
}
else {
?>
<p><h1>Hello!</h1>
<br>If you are seeing this, you have logged in successfully.</p>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment