-4

所以我有这个链接器,您可以从我的应用程序登录到您的帐户(它是一个投标网站)。问题是它会将您发送到该页面并让您登录。有没有办法让我$_POST[]提交并登录到站点,而无需实际离开链接器所在的站点。

如果你需要看什么,请告诉我。

非常感谢!

更新---------------使用jquery

<div class="linkdimesAccount">
<form name="aspnetForm" method="post" action="http://1betvegas.com/default.aspx" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'ctl00_MainContent_ctlLogin_BtnSubmit')" id="aspnetForm" style="margin: 0 0 0 0;">
            <script type="text/javascript">
                //<![CDATA[
                var theForm = document.forms['aspnetForm'];
                if (!theForm) {
                    theForm = document.aspnetForm;
                }
                function __doPostBack(eventTarget, eventArgument) {
                    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
                        theForm.__EVENTTARGET.value = eventTarget;
                        theForm.__EVENTARGUMENT.value = eventArgument;
                        theForm.submit();
                    }
                }
                //]]>
                </script>
             <div>
            <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="">
            <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="">
            <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="eYjk1H7gGdxNJmuevBY9L0vo1lS2NWgmApCJFEQznQr+AwZaPf/hYV4iGSnPCSknyHjESN/BgHueeChVuGgmN4wtWFCdUaYPJRItirNF0nIBHe9Q">
            </div>
            <script src="/WebResource.axd?d=FrT3YL7-WvrI_DKD4vsDo2d0Al_8j_u_HUym76C9Z5ggdJlIe1yu5cWI_jZDYcizjTU0SkefrocS8ATa0&amp;t=634604245351482412" type="text/javascript"></script>
            <div>

                <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="yepc3zJ4Kjr5ru/aXm+s9SqYXyFoM+cwIlWPI69lDMnO4eybZJ1cM1pfzowM47Ggezne5505JNUx/VGe3XO8OCmvZnghqv8ZCuJm+yffjs4inz2n6ctjK/0F/qER0ARSznB8iJsMIZ7HxPXA/Stv+0ubH0U=">
            </div>
            <h2>Link your 5dimes account</h2>

                <table>
                    <tr>
                    <?php
                    if ($dimesaccount == 1){
                    echo "<h2 style='color:red;'> Please note your account is already linked.  If password or other information has changed please re-enter your username and password";
                    }
                    ?>
                        <td>
                        Username:
                        </td>
                         <td>
                            <input name="ctl00$MainContent$ctlLogin$_UserName" type="text" size="15" id="ctl00_MainContent_ctlLogin__UserName" accesskey="u" tabindex="60" class="login_input">
                        </td>
                    </tr>
                    <tr>
                     <td>
                        Password:
                        </td>
                    <td>
                        <input name="ctl00$MainContent$ctlLogin$_IdBook" type="hidden" id="ctl00_MainContent_ctlLogin__IdBook">
                        <input name="ctl00$MainContent$ctlLogin$Redir" type="hidden" id="ctl00_MainContent_ctlLogin_Redir" value="wager/welcome.aspx">
                        <input name="ctl00$MainContent$ctlLogin$_Password" type="password" size="15" id="ctl00_MainContent_ctlLogin__Password" accesskey="p" tabindex="61" class="login_input">
                    </td>
                    </tr>
                    <tr>
                    <td>
                        <input type="submit" name="ctl00$MainContent$ctlLogin$BtnSubmit" value="Link" id="ctl00_MainContent_ctlLogin_BtnSubmit" class="login_input" style="text-transform: uppercase;">
                    </td>
                    </tr>

                </table>


        </div><!-------.linkdimesAccount ------>
        </form>
        <div id="result"></div>
        <script>
  /* attach a submit handler to the form */
  $("#aspnetForm").submit(function(event) {

    /* stop form from submitting normally */
    event.preventDefault(); 

    /* get some values from elements on the page: */
    var $form = $( this ),
        term = $form.find( 'input[name="__EVENTTARGET"]' ).val(),
        term1 = $form.find( 'input[name="__EVENTARGUMENT"]' ).val(),
        term2 = $form.find( 'input[name="__VIEWSTATE"]' ).val(),
        term3 = $form.find( 'input[name="ctl00$MainContent$ctlLogin$_UserName"]' ).val(),
        term4 = $form.find( 'input[name="ctl00$MainContent$ctlLogin$_IdBook"]' ).val(),
        term5 = $form.find( 'input[name="ctl00$MainContent$ctlLogin$Redir"]' ).val(),
        term6 = $form.find( 'input[name="ctl00$MainContent$ctlLogin$_Password"]' ).val(),
        term7 = $form.find( 'input[name="ctl00$MainContent$ctlLogin$BtnSubmit"]' ).val(),

        url = $form.attr( 'action' );

    /* Send the data using post and put the results in a div */
    $.post( url, { s: term, s: term1, s: term2, s: term3, s: term4, s: term5, s: term6, s: term7 },
      function( data ) {
          var content = $( data ).find( '#content' );
          $( "#result" ).empty().append( content );
      }
    );
  });
</script>

因此,当运行它时,它会将我带到登录页面,即使它应该随着 eh 事件停止而停止。

4

2 回答 2

2

如果您不想使用 javascript/jquery,您可以发布到 iframe:

http://css-tricks.com/snippets/html/post-data-to-an-iframe/

This has the added ability of being able to handle file uploads. It's a good way of not leaving the page upon submission of a form. If you want jquery, see the other guys answer, it's fine too.

于 2012-10-23T22:55:31.540 回答
1

试试 jQuery$.post(url, data, function(a,b){..manage success result..})

于 2012-10-23T22:52:59.527 回答