HTML/CSS/JavaScript Help Please?

  • Thread starter Thread starter Tomsaay
  • Start date Start date
T

Tomsaay

Guest
I have a page, that I have password protected, using just some simple JavaScript, but I have another page that I want to only be viewable if the password has been entered. How can I do this? What JavaScript should i add?
 
You cannot dot this using JavaScript because it is client-side script. User can easily view and modify it. You need to use some server side script like PHP, asp.net or something like this to implement login system. After this you can use javascript to login and validating user id password using ajax.
 
Add to encryption page:

document.location = "myurl.com/viewable.html?pw=" + password;

Add to viewable page:

str = document.location;
str = str.split("?")[1];
str = str.split("=")[1'];

if(str = password)
{
go in
}

btw, javascript is not very safe. Use php wherever possible.
 
Back
Top