sexbotz Posted November 3, 2013 Share Posted November 3, 2013 (edited) 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 November 3, 2013 by sexbotz Quote Link to comment https://forums.phpfreaks.com/topic/283557-how-do-i-wrap-html-form-tags-in-javascript-while-loop/ Share on other sites More sharing options...
Ch0cu3r Posted November 3, 2013 Share Posted November 3, 2013 (edited) 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 November 3, 2013 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/283557-how-do-i-wrap-html-form-tags-in-javascript-while-loop/#findComment-1456691 Share on other sites More sharing options...
sexbotz Posted November 3, 2013 Author Share Posted November 3, 2013 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 Quote Link to comment https://forums.phpfreaks.com/topic/283557-how-do-i-wrap-html-form-tags-in-javascript-while-loop/#findComment-1456709 Share on other sites More sharing options...
.josh Posted November 3, 2013 Share Posted November 3, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/283557-how-do-i-wrap-html-form-tags-in-javascript-while-loop/#findComment-1456751 Share on other sites More sharing options...
sexbotz Posted November 3, 2013 Author Share Posted November 3, 2013 How does xrumer do it? By the way I'm really glade to be chatting with advanced programmers like myself, happy for a change specially when I live in a city filled with hicks. Quote Link to comment https://forums.phpfreaks.com/topic/283557-how-do-i-wrap-html-form-tags-in-javascript-while-loop/#findComment-1456774 Share on other sites More sharing options...
.josh Posted November 3, 2013 Share Posted November 3, 2013 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? Quote Link to comment https://forums.phpfreaks.com/topic/283557-how-do-i-wrap-html-form-tags-in-javascript-while-loop/#findComment-1456775 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.