Version: , by Atian
Developer Last Online: Dec 2002
Version: Unknown
Rating:
Released: 03-27-2002
Last Update: Never
Installs: 0
No support by the author.
Change the items in red, cut and paste the script in your <HEAD></HEAD> tags... of course without the vB script as well.
<script language="JavaScript">
<!--hide from old browsers
// Below is where you specify your password
var password;
var pass1="password";
// Below is where you specify the prompt
password=prompt('Password?',' ');
// If the password equals the variable pass1
// then you'll get an alert saying you're correct
// if you were wrong, you'd be taken to an .htm
// saying you were wrong
// Specify the alert message below
if (password==pass1)
alert('Password was right!');
// Specify the URL if they got it wrong
else
{
window.location="wrongpass.htm";
}
//--> End of script
</SCRIPT>
Of course there are more ways to do this, and JavaScript can be found out easily, I mean, they can just view your source....
There are ways you can make it harder for the regular newbie to not see the source.. you can save the script as a .js file and insert it in the <HEAD></HEAD> part of your page as
so they can't see the details of your script, or you can make an intermediate page, that is, the prompt script would be in "somepage.htm" and if they get the prompt correct they'd be taken to your homepage (or whatever you're protecting) and if they got it wrong they'd be taken to another URL. But you would have to make a page that houses JUST the script, like this:
<HTML>
<HEAD>
<TITLE>Intermediate Page</TITLE>
<SCRIPT language="JavaScript">
<!-- Hide from old browsers
// alter the prompt message
var password=prompt('Enter the password:','');
//alter the password
var mypassword="password";
if (password==mypassword)
{
window.location="myURL.htm";
}
else
{
window.location="http://www.oprah.com";
}
//--> End of script
</SCRIPT>
</HEAD>
<BODY></BODY>
</HTML>
If they were right, they'd be taken to your URL, if they were wrong, they'd go to Oprah's webpage.
But remember, JavaScript isn't the way to go if you want to prtect something really important. People can get in. This just makes it harder for newbs to get in. If you want a real safe way to protect your page, you might want to look into CGI scripts.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
yeah i know,i got confused i thought this was to give help in coding,well,the only php code that i added was the custom karma but...i get confused alot :/