Created
October 30, 2008 09:58
-
-
Save sunny/20958 to your computer and use it in GitHub Desktop.
This file contains 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 | |
if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' | |
and isset($_GET['user']) and isset($_GET['pass'])) { | |
header('Content-type: text/plain'); | |
echo htmlspecialchars($_GET['user'] . ':' . crypt($_GET['pass'])); | |
exit; | |
} | |
?> | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
<title>Htpass</title> | |
<script src="js/prototype.js" type="text/javascript"></script> | |
<script src="js/scriptaculous.js" type="text/javascript"></script> | |
<style type="text/css"> | |
body { margin: 5em; font: .9em sans-serif; } | |
h1 { margin-bottom: 0; } | |
.desc { margin-top: 0; } | |
#code { background: #ccc; } | |
</style> | |
<script type="text/javascript"> | |
Event.observe(window, 'load', function() { | |
Event.observe('form', 'submit', function(e) { | |
Event.stop(e); | |
$('form').request({ | |
onSuccess: function(r) { | |
new Insertion.Bottom('code', r.responseText + "\n"); | |
new Effect.Highlight('code', { | |
startcolor:'#eeeeee', | |
endcolor:'#cccccc', | |
restorecolor:'#cccccc' | |
}); | |
$('user').activate(); | |
} | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>Htpass</h1> | |
<p class="desc">An htpassword generator</h1> | |
<form method="get" action="index.php" id="form"> | |
<p> | |
<label for="user">User</label> | |
<input type="text" name="user" id="user" /> | |
</p> | |
<p> | |
<label for="pass">Pass</label> | |
<input type="password" name="pass" id="pass" /> | |
</p> | |
<p><input type="submit" value="OK" id="ok"></p> | |
</form> | |
<pre><code id="code"><?php if (isset($_GET['user']) and isset($_GET['pass'])) echo htmlspecialchars($_GET['user'] . ':' . crypt($_GET['pass']) . "\n"); ?></code></pre> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment