Last active
October 11, 2020 23:36
-
-
Save adamcjoiner/547726afd53b49203f872d957d43824d to your computer and use it in GitHub Desktop.
PHP: Simple password protected page with md5 (found on: https://stackoverflow.com/questions/4115719/easy-way-to-password-protect-php-page)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$user = $_POST['user']; | |
$pass = md5($_POST['pass']); | |
$hash = "enter your md5 hash here"; | |
if($user == "admin" | |
&& $pass == $hash) | |
{ | |
echo "Secure content:"; | |
include("content.html"); | |
} | |
else | |
{ | |
if(isset($_POST)) | |
{?> | |
<form method="POST" action="secure.php"> | |
User <input type="text" name="user"></input><br/> | |
Pass <input type="password" name="pass"></input><br/> | |
<input type="submit" name="submit" value="Go"></input> | |
</form> | |
<?} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe not to use md5 without adding text (salt)?
Or even better to use md55