Generador de usuario-contraseña


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <!-- ONE STEP TO INSTALL LOGIN CODER:
  2.  
  3. 1. Add the first code into the BODY of your HTML document -->
  4.  
  5. <!-- STEP ONE: Add the first code into the BODY of your HTML document -->
  6.  
  7. <BODY>
  8.  
  9. <center><table border=1>
  10. <tr><form name=members><td rowspan=4>
  11. <select name=memlist size=10 onChange="showmem(this.form)">
  12.  
  13. <!-- Original: Dion -->
  14. <!-- Web Site: http://www.iinet.net.au/~biab/ -->
  15.  
  16. <!-- This script and many more are available free online at -->
  17. <!-- The JavaScript Source!! http://javascript.internet.com -->
  18.  
  19. <!-- "member name | password | destination pagename |" -->
  20. <option selected value="John Smith|password|mainpage|">John Smith
  21. <option value="Peter Jones|theirpwd|endpages|">Peter Jones
  22. <option value="Sue Brown|asdfvcxz|nowheres|">Sue Brown
  23. <option value="Sally West|zaqxswde|logintop|">Sally West
  24. </select></td>
  25. <td align=right>User:</td><td><input type=hidden value="0" name=entry>
  26. <input type=text name=memname size=8 value=""></td></tr>
  27. <tr><td align=right>Password:</td><td><input type=text name=password size=8 maxlength=8><font size="-1"><-- Must be exactly 8 characters</font></td></tr>
  28. <tr><td align=right>Page Name:</td><td><input type=text name=pagename size=8 maxlength=8><b>.html</b><font size="-1"><-- Must be exactly 8 characters</font></td></tr>
  29. <tr><td colspan=2 align=center>
  30. <input type=button value="New User" onclick="addnew(this.form);">
  31. <input type=button value="Delete User" onclick="delthis(this.form);">
  32. <input type=button value="Update/Show Coding" onclick="update(this.form); create(this.form);"></td></tr>
  33. <tr><td colspan=3 align=center>
  34. <input type=text size=60 name=message value="Note: Password/Page Name must be exactly 8 letters! (a-z)">
  35. <input type=hidden name=num value=1></td>
  36. </form></tr>
  37. </table>
  38. <hr size=2 width=75%>
  39. <form name=js><textarea cols=75 rows=10 name=scrpt wrap=virtual>
  40. <SCRIPT LANGUAGE="JavaScript">
  41. <!-- Begin
  42. var params=new Array(4);
  43. var alpha="ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHI";
  44. function check(form) {
  45. which=form.memlist.selectedIndex;
  46. choice = form.memlist.options[which].value+"|";
  47. if (choice=="x|") {
  48. alert("Please Select Your Name From The List");
  49. return;
  50. }
  51. p=0;
  52. for (i=0;i<3;i++) {
  53. a=choice.indexOf("|",p);
  54. params[i]=choice.substring(a,p);
  55. p=a+1;
  56. }
  57. h1=makehash(form.pass.value,3);
  58. h2=makehash(form.pass.value,10)+" ";
  59. if (h1!=params[1]) {
  60. alert("Incorrect Password!"); return; };
  61. var page="";
  62. for (var i=0;i<8;i++) {
  63. letter=params[2].substring(i,i+1)
  64. ul=letter.toUpperCase();
  65. a=alpha.indexOf(ul,0);
  66. a-=(h2.substring(i,i+1)*1);
  67. if (a<0) a+=26;
  68. page+=alpha.substring(a,a+1); };
  69. top.location=page.toLowerCase()+".html";
  70. }
  71. function makehash(pw,mult) {
  72. pass=pw.toUpperCase();
  73. hash=0;
  74. for (i=0;i<8;i++) {
  75. letter=pass.substring(i,i+1);
  76. c=alpha.indexOf(letter,0)+1;
  77. hash=hash*mult+c;
  78. }
  79. return(hash);
  80. }
  81. // End -->
  82. </script>

URL: http://javascript.internet.com/passwords/login-coder.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.