Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Scripts

Reply
 
LinkBack Thread Tools Display Modes
Old 09-30-2006, 02:02 AM   #1 (permalink)
Bronze Member
 
Join Date: Jun 2006
Posts: 26
Send a message via ICQ to timothyb89 Send a message via AIM to timothyb89 Send a message via MSN to timothyb89 Send a message via Yahoo to timothyb89 Send a message via Skype™ to timothyb89
Default JavaScript Issues...

Ok...
So I'm designing a JavaScript (obviously) to User and Password protect a webpage.
For some strange reason, it won't run, and I've managed to trace it to a seemingly nonexistant problem on line 27 (with "it (user == user1 || etc, etc) )

So here's my code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
  <title>Your title here</title>

<script type="text/JavaScript">


/*WARNING! This script is untested. It functionality remains unknown.*/


//Varibles for User and Password to be inserted in. You shouldn't need to change these.
var user;
var pass;


//User info viribles. Don't use spaces in anything.
var u1="user1";
var u1pass="user1spassword";
var u1combine="user1user1spassword";

var u2="user1";
var u2pass="user1spassword";
var u2combine="user1user1spassword";

var u3="user1";
var u3pass="user1spassword";
var u3combine="user1user1spassword";

var u4="user1";
var u4pass="user1spassword";
var u4combine="user1user1spassword";

var u5="user1";
var u5pass="user1spassword";
var u5combine="user1user1spassword";

//Beginning of main script
user=prompt('Enter your username');

//User checking
if (user==u1 || user==u2 || user==u3 || user==u4 || user==u5)
{
	pass=prompt('User correct. Enter you password');

	//Checks password
	
	if (pass==u1pass || pass=u2pass || pass==u3pass || pass==u4pass || pass==u5pass)
	{
	}

	else 
	{
	window.location.href="badpassword.htm";
	}
}

else
{
window.location.href="baduser.htm";
}

//Checks user and password combination to make sure the password is owned by the user.

if (user+pass==u1combine || user+pass==u3combine || user+pass==u3combine || user+pass=u4combine || user+pass==u5combine)
{
}

else
{
alert("The user you entered is not associated with the password you entered");
window.location.href="badpair.htm";
}

/*End of script*/

</script>

</head>
<body>


</body>
</html>
So, does andone know what's wrong?
I know I have three syntax errors, and maybe someone can track those down for me? They may or may not be contributing to my problem...

And I don't really want it rewritten...
I just want to know what the problem is (it's the fact that it's "my code") and I really don't want to hear about JavaScript security. I'm just making this for some friends of mine.
__________________
My Site: http://timothyb89.homelinux.org/
timothyb89 is offline   Reply With Quote
Old 02-05-2007, 12:53 PM   #2 (permalink)
New Member
 
Join Date: Feb 2007
Posts: 3
Send a message via Yahoo to possible.in
Default

dont use javascript for user management,
the code is public and ur user management system can be bipassed easily.
rather use server side programming using ASP or PHP or something like that
possible.in is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:07 PM.


Computer Forum - Internet Business - Webpage Design

 
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.