iRoss
14-02-2005, 02:31 PM
Hey,
Protecting private pages with passwords:
Javscript offers a variety of methods by which to password-protect your webpage(s). And some of the methods are very hack proof. However look else where if you are looking for maximum security!
This script is just an example of how javascript can be used to achieve password protection. This is the first part of the script:
<SCRIPT>
<!--
var wrong="if the password the person has enterd is incorrect put the page link 2 where they will be re-directed to here!"
var password="Type The Password You Wish In Here";
var name = prompt ("put what u want the text in the dialog box 2 say in here","the password u enterd here from earlier");
if (name == password) { (confirm("welcome!"))}
else {location.href=wrong}
//-->
</SCRIPT>
--------------------------------------------------------------------------
Here is a working version of it...
<SCRIPT>
<!--
var wrong="sorry.html";
var password="crazyfool";
var name = prompt ("enter the password","crazyfool");
if (name == password) {(confirm("welcome!"))}
else {location.href=wrong}
//-->
</SCRIPT>
--------------------------------------------------------------------------
1. Add the script and comment tags to the HEAD bit of your HTML document.
2. Type the javascript, changing the password to your own password.
3. Test the script in your browser to see if it works.
I hope that has helped someone... If noone :eusa_thin
Thanks :D
Protecting private pages with passwords:
Javscript offers a variety of methods by which to password-protect your webpage(s). And some of the methods are very hack proof. However look else where if you are looking for maximum security!
This script is just an example of how javascript can be used to achieve password protection. This is the first part of the script:
<SCRIPT>
<!--
var wrong="if the password the person has enterd is incorrect put the page link 2 where they will be re-directed to here!"
var password="Type The Password You Wish In Here";
var name = prompt ("put what u want the text in the dialog box 2 say in here","the password u enterd here from earlier");
if (name == password) { (confirm("welcome!"))}
else {location.href=wrong}
//-->
</SCRIPT>
--------------------------------------------------------------------------
Here is a working version of it...
<SCRIPT>
<!--
var wrong="sorry.html";
var password="crazyfool";
var name = prompt ("enter the password","crazyfool");
if (name == password) {(confirm("welcome!"))}
else {location.href=wrong}
//-->
</SCRIPT>
--------------------------------------------------------------------------
1. Add the script and comment tags to the HEAD bit of your HTML document.
2. Type the javascript, changing the password to your own password.
3. Test the script in your browser to see if it works.
I hope that has helped someone... If noone :eusa_thin
Thanks :D