I made this code its supposed to put a password on your forums or website the default pass is "cool".
code:
<HEAD>
<SCRIPT language="JavaScript">
<!--hide
var password;
var pass1="cool";
password=prompt('Please enter your password to view this page!',' ');
if (password==pass1)
alert('Password Correct! Click OK to enter!');
else
{
window.location="www.barbie.com";
}
//-->
</SCRIPT>
</HEAD>
See var password;This creates a variable named "password".
var pass1="cool";This creates a password that will be accepted by the script. We name it pass1 in case we would like to have more than one acceptable password. ( ie pass2, pass3 etc. ).
password=prompt('Please enter your password to view this page!',' '); This is what creates the prompt for the user to enter a password. Whatever the user enters in the prompt will be the value of the variable "password".
if (password==pass1)
alert('Password Correct! Click OK to enter!'); This is where we verify the password. The variable "password" is what the user just typed into the prompt. The variable "pass1" is the only password we will accept. If they are the same, we send them an alert that the password was OK and they can continue.
else
{
window.location="www.barbie.com";
} This is what happens when they type in an incorrect password. We send them to a page of our choice. In IE4, it looks like nothing happened, it just reloads this page. In NS3 and 4 you will probably see the protected page for a quarter of a second. I said it wasn't the most secure script out there, so I would recommend the links at the end of the tutorial so you can get a more secure script. I chose to send it back to this page (jpass.htm), but you can type any url here you want. Maybe you could use something like:
window.location="
http://www.barbie.com";
Make them cringe a little.......thats what mine is...
When i tried on test forum it kept redirecting me to a weird site it was and advertizing site didn't evan ask for pass whats wrong with it???