I have a question about html/JavaScript/PHP, I want to be able to view a few pages only if I fill in the right password, but I don't want that you have to put the password in on every private page you visit.
For example:
pages:
- Login.html
- PrivatePage1.html
- PrivatePage2.html
Now you can just go to: 'http://ift.tt/2uAb4bd' and you don't have to give a password, so is there a way to check if they already logged in on 'Login.hmtl'
My code on 'Login.html'
password();
function password() {
var userPassword;
var myPassword = "a";
userPassword = prompt("Enter the password:");
if(userPassword == myPasswordfun) {
alert('Correct, press ok to enter the site.');
}else if(userPassword == null) {
window.location ="http://www.google.com";
}else {
alert('Incorrect');
password();
}
}
Thanks for reading!
Aucun commentaire:
Enregistrer un commentaire