Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JackT06

macrumors 6502
Original poster
Jul 24, 2009
293
0
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>
 
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.
 
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
 
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.
 
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.

Sorry im new to jav, where abouts do i put that line?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.