Jump to content

password protection + counter


killay

Recommended Posts

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 = 0
and 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

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

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 server
oh ok... well thx for the reply
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...