Results 1 to 5 of 5

Thread: Password Protection

  1. #1
    Join Date
    Jan 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Password Protection

    1) Script Title: Encrypted Password script

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

    3) Describe problem:
    I was wondering how I could change it to one field, as I dont need a username just a pssword field.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Here you go:

    Code:
    <script type="text/javascript">
    //Encrypted Password script- By Rob Heslop
    //Script featured on Dynamic Drive 
    //Visit http://www.dynamicdrive.com 
    
    function submitentry(){
    password = document.password1.password2.value.toLowerCase()
    passcode = 1
    
    for(i = 0; i < password.length; i++) {
    passcode *= password.charCodeAt(i);
    }
    
    //CHANGE THE NUMBERS BELOW TO REFLECT YOUR PASSWORD
    if(passcode==126906300)
    //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR PASSWORD
    {
    window.location=password+".htm"}
    else{
    alert("password incorrect")}
    }
    </script>
    
    <form name="password1">
    <strong>Enter password: </strong>
    <input type="password" name="password2" size="15">
    <input type="button" value="Submit" onClick="submitentry()">
    </form>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jan 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you very much Ill try it out and get back to you.

  4. #4
    Join Date
    Jan 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hi I have tried this and it doesnt work has anyone else got any ideas or know of another script that might work.

  5. #5
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,626
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    The script works well with a single field as thetestingsite furnished but you need to do the following things to make this script run:

    1. First you need to calculate the encrypted value of your password (step 1 mentioned in the script page).

    2. Copy that value and paste that value in the JS code in the following manner:
    Code:
    if(passcode==your_encrypted_value_goes_here)
    3. Next thing you need to have a page whose name is equivalent to your original password (not the encrypted value) and according to the script this file extension is .htm. If you want to open a file with another extension then you need to change the following line:
    Code:
    window.location=password+".htm"
    4. Last but not the least the name of your form and the password field should be password1 and password2 respectively

    .htm can be replaced with your file name extension.

    If you follow these items then the script should work without any problems.

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
  •