note 19719 added to function.md5

From: Date: Fri, 08 Mar 2002 18:53:20 +0000
Subject: note 19719 added to function.md5
Groups: php.notes 
Request: Send a blank email to php-notes+get-27521@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 -- http://www.php.net/manual/en/function.md5.php http://master.php.net/manage/user-notes.php?action=edit+19719 http://master.php.net/manage/user-notes.php?action=delete+19719 http://master.php.net/manage/user-notes.php?action=reject+19719

« previous php.notes (#27521) next »