如何用delphi实现网页log in(150分)

  • 主题发起人 主题发起人 leo_aj
  • 开始时间 开始时间
我没收到啊
 
see that now?
to xewei:

哪个是你的帖子?
 
还是没看到,这样吧,你放在你自己邮箱里,你给我密码,我来看
 
would u want me publish my password here?
i send it again
 
那你把那个login page贴在这里啊
 
我觉得还是使用API比较可靠。
用FindWindow和GetWindow获得要填充内容的Edit和Submit按扭的Handle,然后利用SendMessage就可以完成工作了,好轻松!
 
To redleaf_wgm:

that is what i thought before. u get button handler and send message to windows. but i want to do something different.

To finalrinoa:
it is only available in the intranet. u can't see it over internet. so did u received my email?
 
To finalrinoa:
login page 只有一个表格,一个是user name, 一个是password.里面有2个asp的连接 你可你跟我说一下怎么做,我自己试试。
 
<html>
<head>
<title></title>
</head>
<body>
<form name="form1" method="POST" action="那个表单地址">
<input type=hidden name="username" id="username" value="用户名"><br>
<input type=hidden name="password" id="password" value="密码"><br>
</form>
<script language="javascript">
wait();
function wait(){
form1.submit();
setTimeout("wait()",1000);}
</script>
</body>
</html>


把地址,用户名,密码改一下,然后存成一个HTML文件,然后在程序中调用就可以了
 
to netcore:
我把你的code改为
WebBrowser1.OleObject.Document.loginf.txtusername.value:='username';
WebBrowser1.OleObject.Document.loginf.txtpwd.value:='password';
WebBrowser1.OleObject.Document.loginf.submit()
根据公司的webpage. 但是WebBrowser1.OleObject.Document.loginf.submit()不能submit 我的用户名和密码。it looks like has been submit, but i did n't get into the login page.

any comments?
 
我的方法简单易用你不用,真悲哀啊
 
to finalrinoa:
这是一部分内容。
<tr>
<td colspan="2"><font face="verdana" size="2">Please Sign In</font></td></tr>
<tr>
<td><font face="verdana" size="2">Username :</font></td>
<td><input type="text" name="txtusername" size="30"></td>
</tr>
<tr>
<td><font face="verdana" size="2">Password :</font></td>
<td><input type="password" name="txtpwd" size="30"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Sign In" name="cmdsubmit"></td>
<tr>
但当我submit时我的用户名和密码并没有发送出去。
请问如何解决?多谢。我的code 在上边贴出来了。
 
再上面点有个<form name="" method="POST" action="">的东西,你把这个贴出来,不然我怎么知道它送到哪
 
finalrinoa方法简单明了,推荐
 
我都贴出来了, 不好意思。 我对网页一窍不通,今天第一次看javascript

<html>
<head>onSubmit
<script language="javascript">
function loadform(){
document.loginf.txtusername.focus();
}
</script>
</head>
<body background="images/final1.jpg" class="back" bgcolor="E7EOB6" onload="loadform();">
<Table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="center" width="50%" height="30%">
<img src="images/blank.gif">
</td>
<td align="right" width="50%" valign="bottom">
&amp;nbsp;
</td>
</tr>
<tr>
<td align="center" colspan="2">
&amp;nbsp;
</td>
</tr>
</Table>
<Table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="25%" valign="top">
<script language="javascript">
function newwindow(){
newwin = window.open("policies.asp","");
}

function newwindow2(){
newwin = window.open("schedule.asp","");
}
</script>
<style type="text/css">

a:link {
color: #060685;
text-decoration: none;
}

a:hover {
color: #B85A06;
text-decoration: none;
}

a:visited {
text-decoration: none;
color: #02182C;
}

body.back {
background-repeat: no-repeat;
background-attachment: fixed;
}
</style>
</style>
<Table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td><b>

<a href="signin.asp">
<font face="verdana" size="2">Sign In
</font>
</a>


</b></td>
</tr>
<tr>
<td><b>
<a href="signout.asp">
<font face="verdana" size="2">Sign Out
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="student_main.asp">
<font face="verdana" size="2">Students
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="javascript:newwindow()">
<font face="verdana" size="2">Policies/Procedures
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="javascript:newwindow2()">
<font face="verdana" size="2">Course Schedule
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="ad_signin.asp">
<font face="verdana" size="2">Admin Login
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="ac_signin.asp">
<font face="verdana" size="2">Accounts Login
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="contact.asp">
<font face="verdana" size="2">Contacts
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="dayoff.asp">
<font face="verdana" size="2">End of day sign out
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="index.asp">
<font face="verdana" size="2">Todays Messages
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="addmsg.asp">
<font face="verdana" size="2">Add Message
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="rep_problem.asp">
<font face="verdana" size="2">Computer Problems
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="daily_report.asp">
<font face="verdana" size="2">Lab Report
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="charter.asp">
<font face="verdana" size="2">Charter
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="leaveform.asp">
<font face="verdana" size="2">Leave Form
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="library.asp">
<font face="verdana" size="2">IAL Library
</font>
</b></td>
</tr>
<tr>
<td><b>
<a href="http://www.ulearn.ac.nz">
<font face="verdana" size="2">IAL Website
</font>
</b></td>
</tr>
</Table>
</td>
<td align="left" valign="top">
<Form name="loginf" action="" method="post">
<table border= "1" cellpadding="0" cellspacing="0" width="50%">

<tr>
<td colspan="2"><font face="verdana" size="2">Please Sign In</font></td></tr>
<tr>
<td><font face="verdana" size="2">Username :</font></td>
<td><input type="text" name="txtusername" size="30"></td>
</tr>
<tr>
<td><font face="verdana" size="2">Password :</font></td>
<td><input type="password" name="txtpwd" size="30"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="Sign In" name="cmdsubmit"></td>
<tr>
</table>
</Form>
</td>
</tr>
</Table>
<table width="100%">
<tr align="center">
<td>&amp;nbsp;</td>
<tr>
<tr align="center">
<td>&amp;nbsp;</td>
<tr>
<tr align="center">
<td>&amp;nbsp;</td>
<tr>
<tr align="center">
<td><font face="verdana" size="1">Best viewed at 800 * 600 pixels</font></td>
<tr>
<tr align="center">
<td><font face="verdana" size="1">Created by joby cyriac - tt1</font></td>
<tr>
<tr align="center">
<td><font face="verdana" size="1"><a href="mailto:slava.e@ttrain.co.nz">Notify some Problems</a></font></td>
<tr>
</table>
</body>
</html>


 
finalrinoa
请问如何调用你的code?
 
不过有个问题要注意的,
<form name="form1" method="POST" action="那个表单地址">
<input type=hidden name="username" id="username" value="用户名"><br>
<input type=hidden name="password" id="password" value="密码"><br>
这里面的 name="你登陆页面里的name" 如果这两个name不一致会导致服务器认不出来
 
<html>
<head>
<title></title>
</head>
<body>
<form name="form1" method="POST" action="那个表单地址">
<input type=hidden name="txtusername" id="txtusername" value="用户名"><br>
<input type=hidden name="txtpwd" id="txtpwd" value="密码"><br>
</form>
<script language="javascript">
wait();
function wait(){
form1.submit();
setTimeout("wait()",1000);}
</script>
</body>
</html>

action="那个表单地址"中指的那个表单地址是你贴出来的这个文件的URL,就是你在地址栏里看到的东东,比如"http://127.0.0.1/test.asp"
 
把从<html>开始到</html>(包括<html>和</html>)为止的这些代码放到记事本,然后另存为 1.htm 注意这里的1可以任意,然后你用IE打开这个文件就可以自动登录了
 
请问如何使用你的code?
i saved it as html, and replace the right url address. what 's next?
 
后退
顶部