Simple Password Protection for Small Sites


JavaScript Code
  1. <script language="JavaScript">
  2. <!--hide
  3. var password;
  4. var pass1="bob"; <------------------ Replace "PASSWORD" with the actual password
  5.  
  6. password=prompt('enter password',' ');
  7. if (password==pass1)
  8. alert('correct password');
  9. else
  10. {
  11. window.location="change this to a url";
  12. }
  13. //-->
  14. </script>
Joshua's Avatar
Author:
Views:
2,181
Rating:
Posted on Wednesday 7th May 2008 at 02:03 AM
ShadowMage
ShadowMage's Avatar
Unless you find a script like on Dynamic Drive in which encrypts them x]
Posted on Wednesday 7th May 2008 at 01:23 AM
DjMilez
DjMilez's Avatar
Isn't really that secure because someone could just look at the source. But anyway, it's better than I could do myself :D