Results 1 to 3 of 3

Thread: WANTED: Javascript professionals!

  1. #1
    Join Date
    Sep 2005
    Location
    Here
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation WANTED: Javascript professionals!

    Hello, everyone. I am currently editing a website of mine that is to serve two types of users. As such, I am writing to inquire on the html coding for making two usernames and two passwords for each of the two users, but opening a different window for each user upon submission.

    Here is my code thus far as per Dynamic Drive (THANKS DD!!!):

    <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 = 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==########&&passcode==########)
    //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD
    {
    window.open("blank.htm","","fullscreen,scrollbars");top.window.close()}
    else{
    alert("Invalid Password/Username Combination")}
    }
    </script>
    <font size="1" face="verdana"><div align="center">
    <br>
    <br>
    <form name="password1">
    <strong>Enter Username: </strong><input type="text" name="username2" size="10"> <strong>Enter Password: </strong><input type="password" name="password2" size="10"> <input type="button" value="Submit" onClick="submitentry()">
    </form>



    As observed, I can only let one user in at this time. I am in dire need of some javascript aid. So please please please reply ASAP.

    Thanks everyone. Take care!!!

  2. #2
    Join Date
    Dec 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I had the same problem ... you have to change
    if(usercode==########&&passcode==########)
    to
    if((usercode==########&&passcode==########) || (usercode==########&&passcode==########))
    and it workes for me

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

    Default

    Note that
    Code:
    window.open("blank.htm"
    is insecure: it's the inclusion of the password in the filename that makes this script secure(-ish), and would also allow your two users to be redirected to different pages using maartenvdj's code.
    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
  •