Tuesday, June 06, 2006

Simple Unsecure Password Protection

This is a super simple Javascript code for making a popup that asks for only a password to be entered. If it is correct, it will forward you to the private page, if it is incorrect it will forward you to the error page. Any smart person could do a viewsource to see the password, but this is for those pages on a company intranet where the employees barely know how to use a browser. This should not be used for a public website on the internet or your ass will get hacked!

<SCRIPT LANGUAGE="javascript">
var getin = prompt("What is the password?","")
if (getin=="superpassword")
{
location.href="secretpage.html"
}
else
{
if (getin=="null")
{location.href="errorpage.html"}
else
if (getin!="superpassword")
{location.href="errorpage.html"}
</SCRIPT>

No comments: