killay Posted May 13, 2007 Share Posted May 13, 2007 Hey all,I was trying to make a password protection for the index > not working So this is actually what I had: var password;var pass1="pass1";var pass2="pass2";password=prompt('Please enter your password to view this page!',' ');if (password==pass1 || password==pass2) alert('Password Correct!');else { window.location=".htm"; }This is easy, but i actually need a username too. (user 1 & pass1 || user2 & pass2).Like you can see it's an alert prompt (no form in the body).The other thing I dont know how to is:I need a counter (.txt) to tell me how many times user1 has logged in and user 2.counter.txt:Counter---------user1 = 0user2 = 0and if its possible to input how many times that username is used BUT with a WRONG password.Thanks in advance,Peter Link to comment Share on other sites More sharing options...
Lulzim Posted May 13, 2007 Share Posted May 13, 2007 If you want to password-protect any page, use some server side language. With javascript, everyone can see the passwrod just by viewing the source of the page. The other thing I dont know how to is:I need a counter (.txt) to tell me how many times user1 has logged in and user 2.Javascript is not able to write on a file, be it on client's computer or on server Link to comment Share on other sites More sharing options...
killay Posted May 13, 2007 Author Share Posted May 13, 2007 If you want to password-protect any page, use some server side language. With javascript, everyone can see the passwrod just by viewing the source of the page. Javascript is not able to write on a file, be it on client's computer or on serveroh ok... well thx for the reply Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.