Created
December 8, 2016 15:16
-
-
Save skorotkiewicz/319cafc9df5f13de9d95cb0b1b3001ed to your computer and use it in GitHub Desktop.
.htpasswd generator webpage in php
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
Use this form to generate your encrypted htaccess password. | |
<form method="post" action=""> | |
<p><input type="text" name="login" placeholder="Login" /></p> | |
<p><input type="text" name="password" placeholder="Password" /></p> | |
<p><input type="submit" value="Get" /></p> | |
</form> | |
<?PHP | |
// demo: http://tmp.itunix.eu/aLog.php | |
$login = $_POST['login']; | |
$password = $_POST['password']; | |
if ($password) { | |
echo '<p>/var/www/.htpasswd</p>'; | |
echo '<code style="padding: 20px; background-color: #dedede;">'; | |
$encryptPassword = crypt($password, base64_encode($password)); | |
echo $login . ':' . $encryptPassword; | |
echo '</code>'; | |
?> | |
<p> | |
<br /> | |
<strong>.htaccess file</strong> | |
<br /> | |
AuthName "Please give your password" <br /> | |
AuthType Basic <br /> | |
AuthUserFile /var/www/.htpasswd <br /> | |
Require valid-user <br /> | |
</p> | |
<?PHP | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment