Skip to content

Instantly share code, notes, and snippets.

@adamcjoiner
Last active October 11, 2020 23:36
Show Gist options
  • Save adamcjoiner/547726afd53b49203f872d957d43824d to your computer and use it in GitHub Desktop.
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)
<?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>
<?}
}
?>
@minherc
Copy link

minherc commented Oct 11, 2020

Maybe not to use md5 without adding text (salt)?
Or even better to use md55

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment