Results 1 to 1 of 1
I HAVE done a lot of searching on this matter, but alas, I can't find what I need. At work, I have an associate network, and if I forget to ...
- 08-26-2011 #1Just Joined!
- Join Date
- Dec 2006
- Posts
- 41
Passing URL arguments to press a form button?
I HAVE done a lot of searching on this matter, but alas, I can't find what I need. At work, I have an associate network, and if I forget to open a browser and click the "Submit" button, I sometimes start doing things in the terminal and wonder why I can't connect to the internet.
SO, I was wondering what arguments I would have to append to a URL to log in automatically. Below is the URL that my work automatically redirects me to when I try to browse to Google (I obviously masked out some fields) and the source to the page. Any thoughts?
Code:https://www.company.com/fs/customwebauth/wap-guest.html?switch_url=https://www.company.com/login.html&ap_mac=10:10:10:10:10:10&wlan=Guest&redirect=www.google.com/
HTML Code:<html> <head> <meta http-equiv="Pragma" content="no-cache"> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <title>Associate Wireless Access</title> <link rel="stylesheet" type="text/css" href="global.css" /> <style type="text/css"> #legal { text-align: left; background-color: #FFF; border-style: solid; border-width: 1px; width: 500px; height: 475px; overflow: auto; padding: 15px; margin: 0px auto; } </style> <script> function submitAction(){ var link = document.location.href; var searchString = "redirect="; var equalIndex = link.indexOf(searchString); var redirectUrl = ""; var urlStr = ""; if (document.forms[0].action == "") { var url = window.location.href; var args = new Object(); var query = location.search.substring(1); var pairs = query.split("&"); for(var i=0;i<pairs.length;i++){ var pos = pairs[i].indexOf('='); if(pos == -1) continue; var argname = pairs[i].substring(0,pos); var value = pairs[i].substring(pos+1); args[argname] = unescape(value); } document.forms[0].action = args.switch_url; } if(equalIndex > 0) { equalIndex += searchString.length; urlStr = link.substring(equalIndex); if(urlStr.length > 0){ redirectUrl += urlStr; if(redirectUrl.length > 255) redirectUrl = redirectUrl.substring(0,255); document.forms[0].redirect_url.value = redirectUrl; } } document.forms[0].buttonClicked.value = 4; document.forms[0].submit(); } function reject() { alert("You will not be able to access the system!"); } function loadAction(){ var url = window.location.href; var args = new Object(); var query = location.search.substring(1); var pairs = query.split("&"); for(var i=0;i<pairs.length;i++){ var pos = pairs[i].indexOf('='); if(pos == -1) continue; var argname = pairs[i].substring(0,pos); var value = pairs[i].substring(pos+1); args[argname] = unescape(value); } document.forms[0].action = args.switch_url; } </script> </head> <body bgcolor=#FFEECC topmargin="50" marginheight="50" onload="loadAction();"> <div class="container"> <div class="outerWrapper"> <div class="innerWrapper"> <div class="header">w <div class="globalNav"> <div class="globalLinks"> </div> </div> </div> <div class="content" id="divContent"> <center> <form method="post"> <input TYPE="hidden" NAME="buttonClicked" SIZE="16" MAXLENGTH="15" value="0"> <input TYPE="hidden" NAME="redirect_url" SIZE="255" MAXLENGTH="255" VALUE=""> <input TYPE="hidden" NAME="err_flag" SIZE="16" MAXLENGTH="15" value="0"> <font color="#FDBB30" size="50">Associate Wireless Access</font><br><br> <br> <p><input type="button" name="Submit" value="Accept" class="button" onclick="submitAction();"></p> </form> </center> </div> <div class="footer" title="Footer"> <div class="footerContent"> <p> </p> </div> </div> </div> </div> </div> </body> </html>


Reply With Quote