Delphi Indy控件实现网络验证与asp通信
来源:互联网 发布:js函数注释规范 编辑:程序博客网 时间:2024/04/27 22:31
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, SHDocVw, StdCtrls, ComCtrls, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdHTTP;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
Label1: TLabel;
state: TStatusBar;
IdHTTP1: TIdHTTP;
Memo1: TMemo;
Label2: TLabel;
Edit2: TEdit;
Button2: TButton;
Label3: TLabel;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
name:String;
password:string;
GetURL :String;
PostURL :String;
GetHtml :String;
sParams :String;
aParams :TStrings;
aStream :TStringStream;
begin
IdHTTP1 := TIdHTTP.Create(nil);
aParams := TStringList.Create;
aStream := TStringStream.Create('');
memo1.Lines.Clear ;
name:=edit1.Text ;
password:=edit2.Text ;
GetURL := 'http://localhost/getinfo.asp'; {登录页面网址}
PostURL := 'http://localhost/getinfo.asp?password='+password; {提交网址}
sParams := 'name='+name; {提交参数}
try
aParams.Clear;
aParams.Add(sParams);
GetHtml := IdHTTP1.Get(GetURL); {取登录页面}
IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
IdHTTP1.Post(PostURL, aParams, aStream); {提交}
memo1.lines.Add(aStream.DataString);
memo1.SelectAll ;
finally
IdHTTP1.Free;
aParams.Free;
aStream.Free;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close();
end;
end.
-----------------------------------------------------GetInfo.asp----------------------------------------
<%@LANGUAGE = VBScript.Encode%>
<!--#include file="conn.asp"-->
<%
dim rs,sql,username,regcode,active,password,founderr,msg
username=trim(request("name"))
password=trim(request("password"))
if username="" then
founderr=true
msg="username参数无效!"
else
founderr=false
end if
if password="" then
founderr=true
msg="password参数无效!"
else
founderr=false
end if
if founderr=true then
response.write msg
else
set rs=Server.CreateObject("ADODB.RecordSet")
sql="select * from reguser where username='"&username&"' and password='"&password&"'"
rs.open sql,conn,1,1
if rs.recordcount>0 then
if trim(rs("regcode"))<>"" then
response.write rs("regcode")
else
response.write "返回的用户注册码无效!"
end if
else
response.write "输入的用户名不存在或者密码无效!"
end if
rs.close
set rs=nothing
end if
call closeconn()
%>
- delphi indy控件实现网络验证与asp通信
- Delphi Indy控件实现网络验证与asp通信
- Delphi Indy控件实现网络验证与asp通信
- 关于Delphi中Indy控件,TCP通信实时性问题
- delphi中利用Indy的TIdFtp控件实现FTP协议
- delphi中利用Indy的TIdFtp控件实现FTP协议
- 在Delphi中使用Indy控件实现邮件群发
- 在Delphi中使用Indy控件实现邮件群发
- 在Delphi中使用Indy控件实现邮件群发
- 用Delphi中的Indy控件实现收发邮件
- delphi Indy 实现天气预报功能
- DELPHI超级Internet控件集--INDY
- DELPHI超级Internet控件集--INDY
- DELPHI超级Internet控件集--INDY
- DELPHI超级Internet控件集--INDY
- DELPHI超级Internet控件集--INDY
- delphi indy控件 idsmtp 邮件发送 gmail
- DELPHI超级Internet控件集--INDY
- tomcat6.0启动不了问题的解决
- [L-php]PHP功能模块——上传下载
- android系统体系结构
- GCC-3.4.6源代码学习笔记(68)
- 获得汉字的拼音首字母
- Delphi Indy控件实现网络验证与asp通信
- 自定义Android组件之带图像的TextView
- 要写博客吗?
- Android系统原理与源码分析(1):利用Java反射技术阻止通过按钮关闭对话框
- 将字符串转换为日期,将日期转换成指定格式的字符串
- [L-php]PHP功能模块——表单相关
- GCC-3.4.6源代码学习笔记(69)
- 传白色版iPhone 4延期上市因漏光问题所致
- 《你能行:微软精英的职场心里话》