Problem login in a web login for that uses javascript
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Problem login in a web login for that uses javascript

  1. #1
    Join Date
    May 2011
    Posts
    1

    Unhappy Problem login in a web login for that uses javascript

    Hello:

    im new on this forum, but i used it sometimes to solve some problems, now i have one that i cant solve it.

    I want to logon in a web witch uses a javascript code in his logon form, i tried to pass the logon with a post method code like i have done in other webs login:


    Code:
    String url="http://www.THEURLWHEREIWANTTOLOGIN.com";
    				HashMap<String, String> data = new HashMap<String, String>();
    				data.put("NAME", "AAAAAAAA");
    				data.put("PASS", "BBBBBBBBBB");
    				URL siteUrl = new URL(url);
    				HttpURLConnection conn = (HttpURLConnection) siteUrl.openConnection();
    				conn.setRequestMethod("POST");
    				conn.setDoOutput(true);
    				conn.setDoInput(true);
    				
    				DataOutputStream out = new DataOutputStream(conn.getOutputStream());
    				
    				Set keys = data.keySet();
    				Iterator keyIter = keys.iterator();
    				String content = "";
    				for(int i=0; keyIter.hasNext(); i++) {
    					Object key = keyIter.next();
    					if(i!=0) {
    						content += "&";
    					}
    					content += key + "=" + URLEncoder.encode(data.get(key), "UTF-8");
    				}
    				out.writeBytes(content);
    				out.flush();
    				out.close();
    				BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));

    but in this web that have a login with javascript code doesnt work, and i dont know how to do it. code of login:

    Code:
    <!-- login --><form method="post" action="login.phtml" name="login" style="display:inline"><table border="0" cellpadding="0" cellspacing="1"><tr><td align="right" valign="middle" class="text">Nombre de usuario:&nbsp;<br /><a href="signup.phtml" class="links" title="Registrar">¿Aún no te has registrado?</a></td><td align="right" valign="middle"><input type="text" name="login" size="10" maxlength="10" tabindex="1" style="width:80px;" />&nbsp;</td></tr><tr><td align="right" valign="middle" class="text">Contraseña:&nbsp;<br /><a href="recoverPassword.phtml" class="links" title="Recuperar tu contraseña">¿te has olvidado?</a></td><td align="right" valign="middle">
      <input type="password" name="pass" size="10" maxlength="8" style="width:80px;" tabindex="2" onkeypress="checkEnter(event, 'login')" />&nbsp;</td></tr><tr><td colspan="2" align="right"><input type="hidden" name="action" value="login" />
          <script language="JavaScript" type="text/javascript">
    	<!--
    document.write("<input type=\"hidden\" name=\"&gt;&gt; Login\" value=\"-1\" \/>");document.write("<a href=\"javascript:submitForm('login','&gt;&gt; Login')\;\"");document.write(" tabindex=\"3\"");document.write(" class=\"login\"");document.write(" title=\"&gt;&gt; Login\"");document.write(">");document.write("&gt;&gt; Login");document.write("<\/a>");
            //-->
          </script>
          <noscript>
    <input type="submit" name="&gt;&gt; Login_x" value="&gt;&gt; Login" /></noscript>
    &nbsp;</td></tr></table></form><script language="javascript" type="text/javascript">
    <!--
    document.login.elements[0].focus();
    // -->
    </script><!-- login end -->
    Someone can help me? thanks.

  2. #2
    Join Date
    Jun 1999
    Location
    SW Missouri
    Posts
    3,422

    Re: Problem login in a web login for that uses javascript

    Norm

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center