Results 1 to 2 of 2

Thread: If Statement

  1. #1
    Join Date
    Dec 2008
    Location
    Selby, North Yorkshire
    Posts
    90
    Thanks
    28
    Thanked 2 Times in 2 Posts

    Default If Statement

    1) Script Title: Encrypted Password script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex9/password.htm

    3) Describe problem: I would like the option to open other website pages using this script and I thought a simple else if would do the job.

    Why doesn't this work? I get an 'error on page' message.

    Code:
    }
    //CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
    if(usercode==12211815000&&passcode==1825426317464164800)
    {window.location=password+".asp"}
    else if(usercode==12211815000&&passcode==1912822615180439800)
    //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
    {window.location=password+".asp"}
    else{
    alert("You have entered the wrong information.")}
    }

  2. #2
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    I downloaded the script and inserted your code and it worked perfectly.

    I used john as username with good & bad as the passwords

    Here is what I have
    HTML Code:
    <head>
    <script>
    
    function submitentry(){
    password = document.password1.password2.value.toLowerCase()
    username = document.password1.username2.value.toLowerCase()
    passcode = 1
    usercode = 1
    for(i = 0; i < password.length; i++) {
    passcode *= password.charCodeAt(i);
    }
    for(x = 0; x < username.length; x++) {
    usercode *= username.charCodeAt(x);
    }
    //CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD
    if(usercode==134603040&&passcode==126906300)
    {window.location=password+".asp"}
    else if(usercode==134603040&&passcode==950600)
    //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
    {window.location=password+".asp"}
    else{
    alert("You have entered the wrong information.")}
    }
    
    </script>
    </head>
    <body>
    <form name="password1">
    <strong>Enter username: </strong>
    <input type="text" name="username2" size="15">
    <br>
    <strong>Enter password: </strong>
    <input type="password" name="password2" size="15">
    
    <input type="button" value="Submit" onClick="submitentry()">
    </form>
    </body>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •