Java Login

Discussion in 'Web Design and Development' started by JackT06, Sep 1, 2009.

  1. JackT06 macrumors 6502

    JackT06

    Joined:
    Jul 24, 2009
    #1
    I have this java login script(Below)
    I would like to be able to add mutipale users to what i have got i was wondering is there away to dupilicate :
    Code:
    (text2.value,"test",text1.value,"test") >
    Here is my full Code:
    Code:
    <form action="http://www.netevolution.co.uk" method="post">
        <p>ENTER USER NAME :</p>
        <input type="text" name="text2">
        <p>ENTER PASSWORD :</p>
        <input type="password" name="text1">
        <input type="button" value="Check In" name="Submit" onclick=javascript:validate(text2.value,"test",text1.value,"test") >
    </form>
    
    <script language = "javascript">
    function validate(text1,text2,text3,text4) {
        if (text1==text2 && text3==text4)
            load('affiliate_expert.asp');
        else
        {
            alert('Login incorrect..');
        }
    }
    
    function load(url) {
        location.href=url;
    }
    </script>
     
  2. mufflon macrumors 6502

    Joined:
    Sep 15, 2006
    #2
    do you really want to validate user login and password with javascript?

    If yes (it's really unsafe), then use an array.

    use

    Code:
    var arrayname = array('value1', 'value2', 'value3');
    
    and then just go through em all with a for-loop.
     
  3. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #3
    Couple of comments...

    I'm sorry....

    I cannot in good faith recommend anyone at anytime to try to do what the OP is doing, from a basic security point of view. The code posted here is not "validation" code, it's authentication code. The only time Javascript should be used for situations like this is to validate the form field data for syntax, etc. So the function named in this code is highly misleading.

    @OP

    Javascript is the language being used here, not Java.
    Try to use sensible variable names, especially when seeking help from others
    You should have at least encrypted the real password

    I know this is demo code which does not tie into a database or whatever secure file storage you're using in the production version. We all understand that. But since you didn't disclaim, we all will naturally raise our eyebrows and point out all this stuff - this is a learning based forum after all. I also wish to add you made several spelling mistakes and can only assume English is not your primary language. Bottom line is, as there are so many mistakes and poor logic involved with your request, I felt obligated to respond like this so other folks know we do take security and bad decisions seriously and will point them out.

    Nothing personal.

    -jim
     
  4. bootedbear macrumors 6502

    bootedbear

    Joined:
    Sep 13, 2004
    Location:
    Austin, TX
    #4
    Java is to JavaScript as ham is to hamster.

    And yeah, anyone who does a View Source on the page will know how to login.
     
  5. JackT06 thread starter macrumors 6502

    JackT06

    Joined:
    Jul 24, 2009
    #5
    Sorry im new to jav, where abouts do i put that line?
     
  6. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA

Share This Page