Skip to content

Instantly share code, notes, and snippets.

@tonifisler
Created June 25, 2014 12:48
Show Gist options
  • Save tonifisler/395b4724092164393695 to your computer and use it in GitHub Desktop.
Save tonifisler/395b4724092164393695 to your computer and use it in GitHub Desktop.
Generate htpasswd
<?php
if (isset($_POST['login']) AND isset($_POST['pass']))
{
$login = $_POST['login'];
$pass_crypted = crypt($_POST['pass']);
echo '<p>Ligne &eacute; copier dans le .htpasswd:<br>' . $login . ':' . $pass_crypted . '</p>';
}
else
{
?>
<p>Enter your login and password.</p>
<form method="post">
<p>
Login : <input type="text" name="login"><br>
Mot de passe : <input type="password" name="pass"><br><br>
<input type="submit" value="Crypt this shit!">
</p>
</form>
<?php
}
?>
<?php echo 'Path of .htpasswd: ' . realpath('.htpasswd'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment