登录注册模块代码.docx

上传人:b****0 文档编号:17419109 上传时间:2023-07-25 格式:DOCX 页数:12 大小:16.70KB
下载 相关 举报
登录注册模块代码.docx_第1页
第1页 / 共12页
登录注册模块代码.docx_第2页
第2页 / 共12页
登录注册模块代码.docx_第3页
第3页 / 共12页
登录注册模块代码.docx_第4页
第4页 / 共12页
登录注册模块代码.docx_第5页
第5页 / 共12页
登录注册模块代码.docx_第6页
第6页 / 共12页
登录注册模块代码.docx_第7页
第7页 / 共12页
登录注册模块代码.docx_第8页
第8页 / 共12页
登录注册模块代码.docx_第9页
第9页 / 共12页
登录注册模块代码.docx_第10页
第10页 / 共12页
登录注册模块代码.docx_第11页
第11页 / 共12页
登录注册模块代码.docx_第12页
第12页 / 共12页
亲,该文档总共12页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

登录注册模块代码.docx

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

登录注册模块代码.docx

登录注册模块代码

conn.asp

<%

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

on error resume next

set conn=server.createobject("adodb.connection")

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

if err then

err.clear

set conn = nothing

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

"

response.end

end if

function closedb

conn.close

set conn=nothing

end function

%>

<% 

dim badword

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

if request.querystring<>"" then

chk=split(badword,"|")

for each query_name in request.querystring

for i=0 to ubound(chk)

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

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

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

\n\n');location='"&request.servervariables("http_referer")&"'"

response.end

end if

next

next

end if

%>

reg.asp

--#i nclude file="conn.asp"-->

<%

if request("action")="reg" then

set rs=server.createobject("adodb.recordset")

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

if rs.recordcount>0 then

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

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

response.end()

end if

sql="select * from user" 

set rs=server.createobject("adodb.recordset")

rs.open sql,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

set rs=nothing

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

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

response.end

end if

%>

无标题文档

 

--#i nclude file="top.asp"-->

用户注册

action=reg" onsubmit="return chkform(this)">

用户名

密码

密码提示问题

密码提示答案

 

top.asp

首页

<% 

if session("name")="" then

%>

注册 登陆

忘记密码?

 <%

else 

%>

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

<%

end if

%> 

加密页


login.asp

--#i nclude file="conn.asp"-->

无标题文档

 

--#i nclude file="top.asp"-->

用户登陆

<% 

if session("name")="" then

%>

action=login" onsubmit="return chkform(this)">

用户名

密码

<%

else 

%>

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

<%

end if

%>

loginok.asp

--#i nclude file="conn.asp"-->

<% 

session.timeout=30

if request("action")="login" then

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

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

if name="" or pwd="" then

response.redirect ("login.asp")

end if

set rs=server.createobject("adodb.recordset")

sql="select * from user where name='"&name&"'and pwd='"&pwd&"'"

rs.open sql,conn,1,1

if not rs.eof then

session("name")=name

response.redirect"edit.asp"

else

response.redirect"error.asp"

response.end

end if

end if

%>

loginout.asp

<%

session("name")=""

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

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

response.end

%>

pwd.asp

--#i nclude file="conn.asp"-->

无标题文档

 

--#i nclude file="top.asp"-->

找回密码

action=pwd">

请输入用户名

pwd2.asp

--#i nclude file="conn.asp"-->

无标题文档

 

--#i nclude file="top.asp"-->

找回密码

<% 

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

set rs=server.createobject("adodb.recordset")

sql="select * from user where name='"&name&"'"

rs.open sql,conn,1,1

if not rs.eof then

%>

<%=rs("name")%>

 

">

密码提示问题

<%=rs("wenti")%>

 

密码提示答案

<% else 

%>

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

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

<%end if

%> 

pwd3.asp

--#i nclude file="conn.asp"-->

无标题文档

 

--#i nclude file="top.asp"-->

找回密码

<% 

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

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

set rs=server.createobject("adodb.recordset")

sql="select * from user where name='"&name&"' and daan='"&daan&"'"

rs.open sql,conn,1,1

if not rs.eof then

%>

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

<%=rs("pwd")%>

<% else 

%>

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

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

<%end if

%> 

error.asp

--#i nclude file="conn.asp"-->

无标题文档

 

--#i nclude file="top.asp"-->

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

edit.asp

--#i nclude file="conn.asp"-->

<% 

if request("action")="edit" then

name=session("name")

set rs=server.createobject("adodb.recordset")

sql="select * from user where name='"&name&"'"

rs.open sql,conn,3,2 

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

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

rs.update

rs.close

set rs=nothing

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

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

end if 

%> 

无标题文档

 

--#i nclude file="top.asp"-->

修改资料

<% 

if session("name")="" then

%>

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

<%

else 

%>

<% 

name=session("name")

set rs=server.createobject("adodb.recordset")

sql="select * from user where name='"&name&"'"

rs.open sql,conn,1,1

%> 

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

用户名

<%=rs("name")%>

密码

">

密码提示问题

<%=rs("wenti")%>

密码提示答案

">

 

 <%

end if

%>

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

当前位置:首页 > 人文社科 > 视频讲堂

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

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