注册登陆代码.docx

上传人:b****1 文档编号:1818237 上传时间:2023-05-01 格式:DOCX 页数:17 大小:16.95KB
下载 相关 举报
注册登陆代码.docx_第1页
第1页 / 共17页
注册登陆代码.docx_第2页
第2页 / 共17页
注册登陆代码.docx_第3页
第3页 / 共17页
注册登陆代码.docx_第4页
第4页 / 共17页
注册登陆代码.docx_第5页
第5页 / 共17页
注册登陆代码.docx_第6页
第6页 / 共17页
注册登陆代码.docx_第7页
第7页 / 共17页
注册登陆代码.docx_第8页
第8页 / 共17页
注册登陆代码.docx_第9页
第9页 / 共17页
注册登陆代码.docx_第10页
第10页 / 共17页
注册登陆代码.docx_第11页
第11页 / 共17页
注册登陆代码.docx_第12页
第12页 / 共17页
注册登陆代码.docx_第13页
第13页 / 共17页
注册登陆代码.docx_第14页
第14页 / 共17页
注册登陆代码.docx_第15页
第15页 / 共17页
注册登陆代码.docx_第16页
第16页 / 共17页
注册登陆代码.docx_第17页
第17页 / 共17页
亲,该文档总共17页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

注册登陆代码.docx

《注册登陆代码.docx》由会员分享,可在线阅读,更多相关《注册登陆代码.docx(17页珍藏版)》请在冰点文库上搜索。

注册登陆代码.docx

注册登陆代码

数据库位置:

data/data.mdb

数据库表:

user

idnamepwdwentidaan

conn.asp

<%

db="data/data.mdb"'数据库存放目录

onerrorresumenext

setconn=server.createobject("adodb.connection")

conn.open"driver={microsoftaccessdriver(*.mdb)};dbq="&server.mappath(db)

iferrthen

err.clear

setconn=Nothing

response.write"数据库连接出错,请检查conn.asp中的连接字符串。

"

response.end

endif

functionCloseDB

Conn.Close

setConn=Nothing

EndFunction

%>

<%

dimbadword

badword="'|and|select|update|chr|delete|%20from|;|insert|mid|master.|set|chr(37)|="

ifrequest.QueryString<>""then

chk=split(badword,"|")

foreachquery_nameinrequest.querystring

fori=0toubound(chk)

ifinstr(lcase(request.querystring(query_name)),chk(i))<>0then

response.write"alert('传参错误!

参数"&query_name&"的值中包含非法字符串!

\n\n');location='"&request.ServerVariables("HTTP_REFERER")&"'"

response.end

endif

next

next

endif

%>

reg.asp

--#includefile="conn.asp"-->

<%

ifrequest("action")="reg"then

setrs=server.CreateObject("adodb.recordset")

rs.open"select*fromuserwherename='"&trim(request("name"))&"'",conn,1,1

ifrs.recordcount>0then

response.write"window.alert('您输入的用户名已存在,请返回重新输入!

');history.back(-1);"

response.End()

endif

sql="select*fromuser"

setrs=server.createobject("adodb.recordset")

rs.opensql,conn,1,3

rs.addnew

rs("name")=trim(request.Form("name"))

rs("pwd")=trim(request.Form("pwd"))

rs("wenti")=trim(request.Form("wenti"))

rs("daan")=trim(request.Form("daan"))

rs.update

rs.close

setrs=nothing

response.write"alert('注册成功,点击确定立即登录!

');location.replace('login.asp');"

response.end

endif

%>

无标题文档

--#includefile="top.asp"-->

用户注册

action=reg"onsubmit="returnchkform(this)">

用户名

密码

密码提示问题

密码提示答案

top.asp

首页

<%

ifSession("name")=""then

%>

注册登陆

忘记密码?

<%

else

%>

欢迎您<%=Session("name")%>,注销登陆

<%

endif

%>

加密页


login.asp

--#includefile="conn.asp"-->

无标题文档

--#includefile="top.asp"-->

用户登陆

<%

ifSession("name")=""then

%>

action=login"onsubmit="returnchkform(this)">

用户名

密码

<%

else

%>

<%=Session("name")%>,您已经成功登陆

<%

endif

%>

loginok.asp

--#includefile="conn.asp"-->

<%

Session.TimeOut=30

ifrequest("action")="login"then

name=trim(request.form("name"))

pwd=trim(request.form("pwd"))

ifname=""orpwd=""then

Response.Redirect("login.asp")

endif

setrs=server.createobject("adodb.recordset")

sql="select*fromuserwherename='"&name&"'andpwd='"&pwd&"'"

rs.opensql,conn,1,1

ifnotrs.eofthen

session("name")=name

response.redirect"edit.asp"

else

response.redirect"Error.asp"

response.end

endif

endif

%>

loginout.asp

<%

session("name")=""

response.write"alert('退出登陆成功!

');location.href('index.asp');"

response.end

%>

pwd.asp

--#includefile="conn.asp"-->

无标题文档

--#includefile="top.asp"-->

找回密码

action=pwd">

请输入用户名

pwd2.asp

--#includefile="conn.asp"-->

无标题文档

--#includefile="top.asp"-->

找回密码

<%

name=trim(request.form("name"))

setrs=server.createobject("adodb.recordset")

sql="select*fromuserwherename='"&name&"'"

rs.opensql,conn,1,1

ifnotrs.eofthen

%>

<%=rs("name")%>

">

密码提示问题

<%=rs("wenti")%>

密码提示答案

<%else

%>

你输入的用户名不存在,请

history.back()">返回重新输入,或者注册

<%endif

%>

pwd3.asp

--#includefile="conn.asp"-->

无标题文档

--#includefile="top.asp"-->

找回密码

<%

name=trim(request.form("name"))

daan=trim(request.form("daan"))

setrs=server.createobject("adodb.recordset")

sql="select*fromuserwherename='"&name&"'anddaan='"&daan&"'"

rs.opensql,conn,1,1

ifnotrs.eofthen

%>

<%=rs("name")%>,您的密码

<%=rs("pwd")%>

<%else

%>

你输入的密码提示答案不正确,请

history.back()">返回重新输入

<%endif

%>

error.asp

--#includefile="conn.asp"-->

无标题文档

--#includefile="top.asp"-->

登陆失败,请检查用户名和密码是否正确返回

edit.asp

--#includefile="conn.asp"-->

<%

ifrequest("action")="edit"then

name=session("name")

setrs=server.createobject("adodb.recordset")

sql="select*fromuserwherename='"&name&"'"

rs.opensql,conn,3,2

rs("pwd")=trim(request.Form("pwd"))

rs("daan")=trim(request.Form("daan"))

rs.update

rs.close

setrs=nothing

response.write"alert('编辑成功!

');location.href('edit.asp');"

endif

%>

无标题文档

--#includefile="top.asp"-->

修改资料

<%

ifSession("name")=""then

%>

对不起你还没有登陆,请登陆或者注册

<%

else

%>

<%

name=session("name")

setrs=server.createobject("adodb.recordset")

sql="select*fromuserwherename='"&name&"'"

rs.opensql,conn,1,1

%>

action=edit"method="post"name="form"id="form">

用户名

<%=rs("name")%>

密码

">

密码提示问题

<%=rs("wenti")%>

密码提示答案

">

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2