Jump to content

How do I wrap html form tags in javascript while loop?


sexbotz

Recommended Posts

how do I wrap html form tags in a javascript while loop? Below example isn't working. do I have to do special wrapping when wrapping like the echo in php? If so how? I learn from examples. Basically want this to auto-submit 5 times to my dummy form.

<body>
<SCRIPT LANGUAGE="Javascript">
while(i<5){
 
<form action="http://someweb.com"  method="post" name="form_confirm" id="form_confirm">
<input class="post" type="text" id="username_reg" name="username" value="somethingname" size="25" maxlength="25" />
<input class="post" type="password" name="password_confirm" value="somethingpass" size="25" maxlength="25" />
<input class="mainoption" type="submit" name="submit" id="submit" value="Save">
</form>

document.getElementById("form_confirm").submit();

i++
}

</script>
Edited by sexbotz
Link to comment
Share on other sites

Trying to DDoS/Hack a sites login?

 

To answer you question the JavaScript code will be separate to the html form. Also no matter how many times you want the while loop to submit the form it'll only submit it once. Because as soon as you have submitted the form you'll be redirected to where you are submitting the form to.

<body>
<form action="http://someweb.com"  method="post" name="form_confirm" id="form_confirm">
<input class="post" type="text" id="username_reg" name="username" value="somethingname" size="25" maxlength="25" />
<input class="post" type="password" name="password_confirm" value="somethingpass" size="25" maxlength="25" />
<input class="mainoption" type="submit" name="submit" id="submit" value="Save">
</form>

<SCRIPT LANGUAGE="Javascript">
while(i<5){
document.getElementById("form_confirm").submit();
i++;
}
</script>
Edited by Ch0cu3r
Link to comment
Share on other sites

I'm trying to do a test study on my own website to advance my skill and understanding..

 

I understand why it would stop specially if it was put in that position below the form but making the while loop cover the whole form process can't be possible? If it could cover it then wouldn't it just re-loop to the URL page where the form input is and re insert the code over again from the number you put upon the while loop to stop? Can this be done in query?

 

What about force redirects? Like after the processer is finished in the code it would redirect back to the starting URL of the original loop code?

 

Explain Thanx

Link to comment
Share on other sites

No. Once the form is submitted, the entire page reloads with the response from http://someweb.com. Javascript does not carry over like that. If you want to make it "remember" and continue through the loop, you will need to base the loop on cookies, or else base it on variable output by the server response from http://someweb.com. Both are only possible if http://someweb.com is the same page you are already on (IOW the same as just doing action='')

 

Alternatively, you can convert it to an ajax request to keep it on the same page and loop, however again, this will only work if the requested page is the same domain as the requesting page.

Link to comment
Share on other sites

I don't have any experience with xrumer but it would have to either be a browser addon/extension that works on the the page with the form, or else it is a program making requests to the domain (and still) acting within that domain's scope. For example, if you made a server-side script (or a standolone program with java or c++) that can request the page and store cookies etc. and essentially act as a browser, and then start looping through it, then it is possible, because it is acting within the scope of the page. IOW this can easily be done with a server-side script (e.g. php, perl) or standalone program (e.g. java, c++). Javascript cannot do this alone though. Javascript can only act on pages on the same domain (read up on same domain origin policy and cross-site scripting).

 

And btw, no offense but I do not put people trying to do this sort of thing in the same bucket as me. Also, it's pretty disrespectful to write a whole city off as being stupid. There are many brilliant people who do not program. Even farmers. You do know it takes skill to farm the right way, right?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.