PDA

View Full Version : JavaScript Login Script


ThRoNkA
05-07-2003, 5:22 AM
I was using a JavaScript Login Script that had each user name in the html page and I used the right click disable along with the left and right click disable to make sure my pages were secure. Now, I have moved ISPs and my old one deleted all my files so I am going to have to redo them from scratch. I originally found the script at earthweb's website (dunno their address) in the javascripts section. I want to know if anyone has found this script or knows whereI can find it. I really need it for my business because my customers depend on it! Thanks in advance

Mntsnow
05-08-2003, 9:35 AM
Still looking ThRoNka...My first searches came up empty but I'm keeping my eyes open for ya

SoopaStar
05-08-2003, 9:41 AM
All because you disable the right/left clicking, people still have the edit--view source available. Your best bet is to see if you can get your ISP to allow you to have .htaccess files (assuming they use apache or another browser that works with .htaccess files).
If you can't do that, I would put the javascript in an external js file. May be a little more secure to do it that way.

Paul

SoopaStar
05-08-2003, 9:44 AM
was it something like this:

<script language="JavaScript">
<!--
function Try(passwd) {
if (passwd =="h4x0r") {
alert("Alright! On to level 2...");
location.href = "level2-xfdgnh.xhtml";
}
else {
alert("The password is incorrect. Please don't try again.");
location.href = "http://www.disney.com/";
}
}
//-->
</script>


Found this on this site:
http://www.try2hack.nl/levels/

Paul C.

SoopaStar
05-08-2003, 10:13 AM
Here is a better example:

<head>
<script src="JavaScript"></script>
<script language="JavaScript">
<!--
pwd = prompt("Please enter the password:","");
if (pwd==PASSWORD){
alert("Thanks!\nEntering the website ...");
location.href = CORRECTSITE;
}
else {
alert("WRONG!\nBack to disneyland !!!");
location.href = WRONGSITE;
}
PASSWORD="AbCdE";
CORRECTSITE="protectedpage.htm";
WRONGSITE="http://www.disney.com";
//-->
</script>
</head>
[quote]
someone is going to think the password is AbCdE right? Its not. Note the <script src="JavaScript"></script>. That is an external javascript file that actually has the correct information in it:
[quote]
PASSWORD = "theRealPassword";
CORRECTSITE = "protectedpage.htm";
WRONGSITE = "http://www.disney.com";


still not bullet proof, but pretty good I think.

Paul

ThRoNkA
05-08-2003, 1:56 PM
Some guy found it before you guys. This is what it is. I can add users if I wanted to. Just a simple download area login..


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin

// Nik Drummond (nikd@tpgi.com.au)
// All rights reserved. Sept 29, 1999

function click() {
if (event.button==2) {
alert('Right click is disabled for security reasons.');
}
}
document.onmousedown=click

function Login(){
var done=0;
var username=document.login.username.value;
username=username.toLowerCase();
var password=document.login.password.value;
password=password.toLowerCase();
if (username=="user1" && password=="pass1") { window.location="logged.html"; done=1; }
if (username=="user2" && password=="pass2") { window.location="logged.html"; done=1; }
if (username=="user3" && password=="pass3") { window.location="logged.html"; done=1; }
if (username=="user4" && password=="pass4") { window.location="logged.html"; done=1; }
if (done==0) { alert("Invalid user name or password. Please try again."); }

//The following are the greetings for each user

if (username=="user1" && password=="pass1") { alert(" Hello user1! "); }
if (username=="user2" && password=="pass2") { alert(" Hello user2! "); }
if (username=="user3" && password=="pass3") { alert(" Hello user3! "); }
if (username=="user4" && password=="pass4") { alert(" Hello user4! "); }


}
// End -->

SoopaStar
05-08-2003, 2:10 PM
def. not very secure. hope you don't have important stuff in the hidden page or anything. I would combine that script with the 'hidden' method of the second one I posted.
Thats a nifty jscript though.
Paul

Mntsnow
05-08-2003, 8:34 PM
SoopaStar is correct in that this should NOT be used to secure a area that you really dont want people to get into. Anytime I get a disabled right click it peaks my curiosity and I will go "snooping" to see what they are trying to hide ;)

ThRoNkA
05-09-2003, 5:18 AM
Well I want to have a script like that but have it secure then. How would I change this to use an external js file?

Cabinetmaker
05-10-2003, 8:30 PM
an external JS is a little more secure but we are talking a very very very little more. I would not recomend using it at all.

ThRoNkA
05-10-2003, 10:56 PM
I mean, I am not like gonna post a credit card submission area or post addresses. It will just have a page with persons name and last services used a how they paid. Something simple. How do you combine the hidden thing with the script?