home *** CD-ROM | disk | FTP | other *** search
/ Magazyn WWW 1999 July / www_07_1999.iso / prez / amiga / KidHTML1_25.lha / KidHTML1.25 / Script / passpro.js < prev    next >
Text File  |  1998-08-25  |  2KB  |  112 lines

  1. <!-- THREE STEPS TO INSTALL PASSWORD PRO:
  2.  
  3.    1.  Configure your access code with the script above.
  4.    2.  Put the designated coding into the HEAD of document
  5.    3.  Copy the final code into the BODY of document  -->
  6.  
  7. <!-- STEP ONE: Configure your access code with the script above!  -->
  8.  
  9. <!-- STEP TWO: Copy this code into the HEAD of your document  -->
  10.  
  11. <HEAD>
  12.  
  13. <SCRIPT LANGUAGE="JavaScript">
  14.  
  15. <!-- Original:  Lefteris Haritou --> 
  16. <!-- Web Site:  lef@writeme.com> www.geocities.com/~lef -->
  17.  
  18. <!-- This script and many more are available online from -->
  19. <!-- The JavaScript Source!! http://javascriptsource.com -->
  20.  
  21. <!-- Begin
  22. var base= new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9","A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z","a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l
  23. var pass=""
  24. var z=23;
  25. var y=28;
  26. var f= new Array();
  27. var K= new Array();
  28. for (x=0; x<10; x++){
  29. f[x]=x<<9
  30. f[x]+=23
  31. }
  32. for (x=10; x<36; x++){
  33. y=y<<1
  34. v= Math.sqrt(y)
  35. v = parseInt(v,16)
  36. v+=5
  37. f[x]=v
  38. y++
  39. }
  40. for (x=36; x<62; x++){
  41. z=z<<1
  42. v= Math.sqrt(z)
  43. v = parseInt(v,16)
  44. v+=74
  45. f[x]=v
  46. z++
  47. }
  48. var iCounter = 3 //How many retries
  49. function inc(){
  50. iCounter--
  51. if (iCounter > 0)
  52. {
  53. if (confirm("\nPassword is incorrect.\n\n\n\nRetry?"))
  54. Check()
  55. else
  56. alert('Password incorrect.');
  57. history.go(-1);
  58.  
  59. // You may use this element istead if you want.
  60. // location.href='denied.html' //Cancel html file
  61.  
  62. }
  63. else
  64. alert('Your three tries are up.  Access Denied.');
  65. history.go(-1);
  66.  
  67. // You may use this element istead if you want.
  68. // location.href='denied.html' // 3 times incorrect html file
  69.  
  70. }
  71. function Check(){
  72. pass = prompt("Enter your password.","")
  73. if(pass==null || pass==""){
  74. history.go(-1)}
  75. else{
  76. var lpass=(pass.length)+1
  77. for (l=1; l<lpass; l++){
  78. K[l]=pass.charAt(l)
  79. }
  80. var code=0;
  81. for (y=1; y<lpass; y++){
  82. for(x=0; x<62; x++){
  83. if (K[y]==base[x]){
  84. code+=f[x]
  85. code*=y
  86.       }
  87.    }
  88. }
  89.  
  90. <!-- STEP TWO: Put access code here!  -->
  91. if (code==174153441)   // code==[your access code]
  92.  
  93. go()
  94. else
  95. inc()
  96.    }
  97. }
  98. function go(){
  99. location.href=pass+".html";
  100. }
  101. // End -->
  102. </SCRIPT>
  103.  
  104. <!-- STEP THREE:  Put this coding into the BODY of your HTML document -->
  105.  
  106. <center>
  107. <A HREF="javascript:Check()">Access the protected area.</A><BR>
  108. <P>
  109. </center>
  110.  
  111. <!-- Script Size:  2.55 KB  -->
  112.