note 19719 deleted from function.md5 by jimw
| From: | jimw@php.net | Date: | Sat, 08 Feb 2003 19:47:41 +0000 |
| Subject: | note 19719 deleted from function.md5 by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-43627@lists.php.net to get a copy of this message | ||
Just as a comment, really - since this is javascript and a bit off-subject:
A way to encrypt the password before it leaves the client (pre-submit encryption).
First you need a js containing the md5 algorithm:
http://www.publicator.no/includes/script/md5.js
Just include the stuff in the <head>
Then add this, either as an include or inline:
<script language="javascript">
<!--
function doLogin() {
document.formname.hash.value = MD5(document.formname.password.value);
document.formname.password.value = "";
document.formname.submit();
}
// -->
</script>
Then the form itself:
<form name="formname" method="post" action="yourscript.php">
<input type="text" name="username" size="9"
maxlength="15">
<input type="password" name="password" value="" size="9"
maxlength="70">
<input onClick="doLogin(); return true;" type="submit"
value="Login">
<input type="hidden" name="hash" value="">
</form>
The js cuts out the password when Login is clicked, md5-encrypts it and submits the hash in the
hidden field.
A good example on how javascript can cooperate with php, and make some use of it self! ;-)
knutm