...

View Full Version : hi im stuck



john9451966
11-03-2011, 01:10 AM
hi im using an encrypted password script, no problem with the script it works fine and forwards the user to urls, there are 8 passcodes, the problem is that on all but one of the passcodes even thought the code works and forwards user to a url, the ALERT box appears as well, i have in included the code and passcodes below. I obviously only want the alert box to appear upon inncorrect passcode entry. thanks


passcodes

14623

24862

36712

45213

56243

61524

74582

84652

{


<script>


function submitentry(){
password = document.password1.password2.value.toLowerCase()

passcode = 1
for(i = 0; i < password.length; i++) {
passcode *= password.charCodeAt(i);
}

//
if(passcode==350859600)
//
{
window.location="http://www.aaaaaaa.php"}

//
if(passcode==379501200)
//
{
window.location="http://www.dddddddd.php"}

//
if(passcode==364618800)
//
{
window.location="http://www.ccccccccccccccccc.php"}

//
if(passcode==424424000)
//
{
window.location="http://www.bbbbbbbbb.php"}

//
if(passcode==416707200)
//
{
window.location="http://www.nnnnnnnnnnnnnnnnnnnnn.php"}

//
if(passcode==393120000)
//
{
window.location="mmmmmmmmmmmmmmmmm.php"}

//
if(passcode==371101500)
//
{
window.location="http://www.pppppppppppppppppp.php"}

//
if(passcode==344362200)
//
{
window.location="http://www.kkkkkkkkkkkkk.php"}

else{
alert("EITHER: Profile set to full private, login to view OR no such user.")}
}
</script>

<form name="password1">

<input type="password" name="password2" size="15">

<input type="image" src="searchbutton.png" onClick="submitentry()">
</form>



}

alykins
11-03-2011, 01:55 AM
that code is brutal... try this


switch (passcode)
{
case 350859600 :
window.location="http://www.aaaaaaaa.php";
break;
case 379501200 :
window.location="http://www.ddddddddddddd.php";
break;
case 364618800 :
window.location="http://www.ccccccccccccccccc.php";
break;
....
(and so on and so on until finally at the end you finish with)
....
default :
alert("EITHER: Profile set to full private, login to view OR no such user.";
break;
}


see how much more readable it is? and should work fine w/o throwing the alert on correct enters...

on a side note...
need to change
<script>
to
<script type="text/javascript">

and also this is for fun right? because anyone can just view your source code, highlight the window.location text and navigate, bypassing your password entry
(just a thought)

oh and finally, this should be in the javascript forum
:)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum