Results 1 to 2 of 2

Thread: Password Protection code

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

    Exclamation Password Protection code

    I was wondering I have this picture on my web site and i have a small box link inside of it. You can't see it but its there so i was trying to get a pop up password box when you clicked it. So you would click the right spot on the page and then it would pop up and say username and password. then u would enter it and the box would dissapear and the main page would change. Does anyone know how to make this code or show me how/where to get it thanx
    does anyone actually know the code or do i have to pay for it.?


    ***
    if anyone knows how to do this does anyone know how to have like a multi user code so that when lets say mr.A signs in he goes to a certain page and then when MR.B signs in under a different username he goes to a different page than MR. A.???? anyone know what im talking about..
    ****

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The first thing you have to understand that this is not, in any way, or under any circumstances, secure. The second is that you'll make your page dependent upon Javascript by using this. The third is that we'd be better modifying the "Encrypted Password Script."
    Code:
    <!-- This goes in the head. -->
    <style type="text/css">
    #passInput {
      display: none;
    }
    
    #showPassInput {
      position: absolute;
    /* modify values as needed */
      top: 50px;
      left: 100px;
      height: 50px;
      width: 50px;
    }
    </style>
    <script type="text/javascript">
    //Encrypted Password script- By Rob Heslop
    // Modified by Twey to hide input stuff
    //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 = 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)
    || (usercode==123950435&&passcode==249320958)
    || (usercode==123095343&&passcode==238432903)
    // Add more user/password combinations here if you like, using the syntax shown above.
    )
    //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
    {
    window.location=password+".htm"}
    else{
    alert("password/username combination wrong")}
    }
    </script>
    <!-- This goes in the body -->
    <div id="passInput">
    <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>
    </div>
    <div id="showPassInput" onclick="document.getElementById('passInput').style.display='block';">
    </div>
    Untested.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •