Jump to content

Password protect a page


SamohtVII

Recommended Posts

Just wondering if this is secure or not to leave on a web page. Not really sure how security and things like passwords on sites work/are protected so any info would be great thanks...

<script type="text/javascript">var password;var pass1 = "password"; // place password herepassword=prompt("Please enter your password:","");if (password==pass1) {window.location= "correct.html"; // file to open if password is correct} else {window.location= "wrong.html"; // file to load if password is incorrect}</script>

ty

Link to comment
Share on other sites

That would not be secured because anyone can view that by viewing the source through the browser and see what the password is. It is recommended for passwords to be processed/handled on the server side.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...