Results 1 to 3 of 3

Thread: Encrypted Password script

  1. #1
    Join Date
    Mar 2008
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Exclamation Encrypted Password script

    Sorry, I wasn't sure where to put this thread.

    I was trying to do this script, can be found here: http://www.dynamicdrive.com/dynamicindex9/password.htm

    I've got my password, username, passcode and usercode.

    I inserted the code into Dreamweaver, but it doesn't work. When I preview it, and type in the correct details, it just says to check the combination.

    This is the code I used:

    HTML Code:
    <script>
    //Encrypted Password script- By Rob Heslop
    //Script featured on Dynamic Drive 
    //Visit http://www.dynamicdrive.com 
    
    function submitentry(){
    password = document.password1.password2.value.toLowerCase()
    username = document.password1.username2.value.toLowerCase()
    passcode = (here i put the passcode)
    usercode = (here i put the usercode)
    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)
    //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
    {
    window.location=password+".htm"}
    else{
    alert("password/username combination wrong")}
    }
    </script>
    
    <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>
    Where it says: '(here i put the pass/user code)' i put in the details. Is that all I should do to make it work?

    Thanks in advance.

  2. #2
    Join Date
    Mar 2008
    Posts
    9
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I have heard that this has happened with 3 other people.

    PLEASE HELP!

  3. #3
    Join Date
    Feb 2008
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi, Jacky,

    I'd suggest not using this script is you want better security. Using PHP, for example, would be a safer solution.

    Further to your issue with this script, I couldn't get it to work as is, but here's an optional solution for you:

    1. Save this as whateveryouwant.html:

    Code:
    <html>
    <head>
    <script language="JavaScript" SRC="dpass.js"></script>
    </head>
    <body>
    </body>
    </html>
    2. This is the .js code. What it does is writes content to your HTML page based on whether the password is correct or not:

    Code:
    var password=prompt("Enter in the password\n HIT CANCEL FOR PASSWORD LIST","Enter Password Here");
    
    if (password == "sos") {
    
    document.write('<CENTER><H1>sos PASSWORD PAGE GENERATED</H1></CENTER> ');
    
    document.write('<p align=center><a href=./password.htm>Return to PASSWORD.HTM</a></p> ');
    
    document.write('<CENTER><BR><BR> THE URL LINKS and CONTENTS OF THIS PAGE ARE GENERATED<BR> FROM THE USER RESPONSE TO A PROMPT <BR>SET-UP BY THE EXTERNAL JAVASCRIPT DPASS.HTM</CENTER> ');
    
    document.write('<CENTER><BR><BR> FOR <B>sos</B> PASSWORD</CENTER> ');
    
    document.write('<CENTER><BR><BR> Using IF..else if..else loops .. <br>you can set-up as many passwords as you like. Also, you can have each unique password<BR>dynamically generate HTML code.<br>Remember.. Javascript is case sensitive.</CENTER> ');
    
    document.write('<CENTER><BR><BR> Password List:<BR><B>sos, music1234, jackd and JACKD</B></CENTER> ');
    
    }
    
    else if (password == "music1234") {
    
    document.write('<CENTER><H1>music1234 PAGE GENERATED</H1></CENTER> ');
    
    document.write('<p align=center><a href=./password.htm>Return to PASSWORD.HTM</a></p> ');
    
    document.write('<CENTER><BR><BR> THE URL LINKS and CONTENTS OF THIS PAGE ARE GENERATED<BR> FROM THE USER RESPONSE TO A PROMPT <BR>SET-UP BY THE EXTERNAL JAVASCRIPT DPASS.HTM</CENTER> ');
    
    document.write('<CENTER><BR><BR> FOR <b>music1234</B> PASSWORD</CENTER> ');
    
    document.write('<CENTER><BR><BR> Using IF..else if..else loops .. <br>you can set-up as many passwords as you like. Also, you can have each unique password<BR>dynamically generate HTML code.<br>Remember.. Javascript is case sensitive.</CENTER> ');
    
    document.write('<CENTER>Password List:<BR><B>sos, music1234, jackd and JACKD</B><br>Passwords are Case Sensitive!!!!</</CENTER> ');
    
    }
    
    else if (password == "jackd") {
    
    document.write('<CENTER><H1>jackd PASSWORD PAGE GENERATED</H1></CENTER> ');
    
    document.write('<p align=center><a href=./password.htm>Return to PASSWORD.HTM</a></p> ');
    
    document.write('<CENTER><BR><BR> THE URL LINKS and CONTENTS OF THIS PAGE ARE GENERATED<BR> FROM THE USER RESPONSE TO A PROMPT <BR>SET-UP BY THE EXTERNAL JAVASCRIPT DPASS.HTM</CENTER> ');
    
    document.write('<CENTER><BR><BR> FOR <B>jackd</B> PASSWORD</CENTER> ');
    
    document.write('<CENTER><BR><BR> Using IF..else if..else loops .. <br>you can set-up as many passwords as you like. Also, you can have each unique password<BR>dynamically generate HTML code.<br>Remember.. Javascript is case sensitive.</CENTER> ');
    
    document.write('<CENTER>Password List:<BR><B>sos, music1234, jackd and JACKD</B><br>Passwords are Case Sensitive!!!!</</CENTER> ');
    
    }
    
    else if (password == "JACKD") {
    
    document.write('<CENTER><H1>JACKD PASSWORD PAGE GENERATED</H1></CENTER> ');
    
    document.write('<p align=center><a href=./password.htm>Return to PASSWORD.HTM</a></p> ');
    
    document.write('<CENTER><BR><BR> THE URL LINKS and CONTENTS OF THIS PAGE ARE GENERATED<BR> FROM THE USER RESPONSE TO A PROMPT <BR>SET-UP BY THE EXTERNAL JAVASCRIPT DPASS.HTM</CENTER> ');
    
    document.write('<CENTER><BR><BR> FOR <b>JACKD</b> PASSWORD</CENTER> ');
    
    document.write('<CENTER><BR><BR> Using IF..else if..else loops .. <br>you can set-up as many passwords as you like. Also, you can have each unique password<BR>dynamically generate HTML code.<br>Remember.. Javascript is case sensitive.</CENTER> ');
    
    document.write('<CENTER>Password List:<BR><B>sos, music1234, jackd and JACKD</B><br>Passwords are Case Sensitive!!!!</CENTER> ');
    
    }
    
    else {
    
    document.write('<CENTER><H1>PAGE GENERATED IF USER HITS CANCEL<br>OR<BR>INCORRECT PASSWORD</H1></CENTER> ');
    
    document.write('<p align=center><a href=./password.htm>Return to PASSWORD.HTM</a></p> ');
    
    document.write('<CENTER><BR><BR>This is the default response<BR>for incorrect passwords or users hitting the cancel button".</CENTER> ');
    
    document.write('<CENTER>You can add any html links, formatted text,etc.</CENTER> ');
    
    document.write('<CENTER>Password List:<BR><B>sos, music1234, jackd and JACKD</B><br>Passwords are Case Sensitive!!!!</CENTER> ');
    
    }
    Edit what you wish in the script.

    Note that this is only an OK solution. For better security and more flexibility, you may want to use PHP or ASP for your authentication. Or, even via your .htaccess file in your server's root dir.

    Cheers,

    UC

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
  •