ASP用户登录注册代码.docx

上传人:b****8 文档编号:10056821 上传时间:2023-02-08 格式:DOCX 页数:8 大小:16.28KB
下载 相关 举报
ASP用户登录注册代码.docx_第1页
第1页 / 共8页
ASP用户登录注册代码.docx_第2页
第2页 / 共8页
ASP用户登录注册代码.docx_第3页
第3页 / 共8页
ASP用户登录注册代码.docx_第4页
第4页 / 共8页
ASP用户登录注册代码.docx_第5页
第5页 / 共8页
点击查看更多>>
下载资源
资源描述

ASP用户登录注册代码.docx

《ASP用户登录注册代码.docx》由会员分享,可在线阅读,更多相关《ASP用户登录注册代码.docx(8页珍藏版)》请在冰豆网上搜索。

ASP用户登录注册代码.docx

ASP用户登录注册代码

ASP用户登录注册代码

1,(index.asp用户登陆页面)

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

会员

--

body,td,th{

font-family:

宋体;

font-size:

14px;

}

-->

会员注册系统

用户名:

密码:

注册

2,(login.asp用户数据处理文件)

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

<%

'打开数据库判断用户是否存在,info为表名,username为字段名

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

sqlc="select*frominfowhereusername='"&request.Form("username")&"'andpassword='"&request.Form("password")&"'"

rsc.opensqlc,conn,1,1

session("username")=rsc("username")

session("password")=rsc("password")

session.Timeout=30

setrsc=nothing

response.Redirect("change.asp")

'如果用户不存在,session("username")为空

%>

3,(change.asp用户信息修改页面)

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

修改

--

body,td,th{

font-size:

14px;

}

-->


<%

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

sqlc="select*frominfowhereusername='"&session("username")&"'andpassword='"&session("password")&"'"

rsc.opensqlc,conn,1,1

nr=rsc("password")

username=rsc("username")

password=rsc("password")

sex=rsc("sex")

qq=rsc("qq")

mail=rsc("mail")

add=rsc("add")

personalinfo=rsc("personalinfo")

vv=rsc("ntime")

setrsc=nothing

ifnr=""then

response.Redirect("index.asp")

endif

ifstrcomp(nr,request.Form("password"))=0then

response.Write("欢迎你!

"&request.Form("username"))

response.Write("你是在"&vv&"注册的")

session("username")=request.Form("username")

endif

ifsession("username")=""then

response.Redirect("index.asp")

endif

%>

ac=ch">

用户名:

">

*

密码:

">

*

性别:

">

QQ:

">

Mail:

">

地址:

">

介绍

<%=personalinfo%>

se=y"target="_self">退出系统

<%ifstrcomp(request.QueryString("se"),"y")=0then

session("username")=""

response.Redirect("index.asp")

endif

%>

<%

ifstrcomp(request.QueryString("ac"),"ch")=0then

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

sql="select*frominfowhereusername='"&session("username")&"'"

rs.opensql,conn,1,3

rs("username")=request.Form("username")

rs("password")=request.Form("password")

rs("mail")=request.Form("mail")

rs("sex")=request.Form("sex")

rs("qq")=request.Form("qq")

rs("add")=request.Form("add")

rs("personalinfo")=request.Form("personalinfo")

rs.update

setrs=nothing

response.Write("修改完成!

")

endif

%>

4,(reg.asp新用户注册页面)

用户注册

--

body,td,th{

font-family:

宋体;

font-size:

14px;

}

-->

用户注册

<%

=request.QueryString("msg")

%>

ac=adduser">

用户名:

*

密码:

*

确定密码:

*

性别:

QQ:

Mail:

地址:

个人介绍

5,(addnewdata.asp新用户注册数据处理文件)

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

成功

<%

ac=request.QueryString("ac")

msg="注册错误信息"

ifrequest.Form("username")=""then

msg=msg&"
"&"用户名不能为空"

endif

ifstrcomp(cstr(request.Form("password")),cstr(request.Form("password2")))<>0then

msg=msg&"
"&"两次密码输入不同"

endif

iflen(request.Form("password"))<6then

msg=msg&"
"&"密码太简单"

endif

ifstrcomp(msg,"注册错误信息")>0then

response.Redirect("reg.asp?

msg="&msg)

endif

ifac="adduser"then

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

sql="select*frominfowhereusername='"&request.Form("username")&"'"

rsc.opensql,conn,1,1

ck=rsc("username")

setrsc=nothing

ifck<>""then

msg=msg&"
"&"用户名被人注册"

response.Redirect("reg.asp?

msg="&msg)

endif

dsql="select*frominfowhereidisnull"

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

rs.opendsql,conn,1,3

rs.addnew

rs("username")=request.Form("username")

rs("password")=request.Form("password")

rs("mail")=request.Form("mail")

rs("sex")=request.Form("sex")

rs("qq")=request.Form("qq")

rs("add")=request.Form("add")

rs("personalinfo")=request.Form("personalinfo")

rs("ntime")=now

rs.update

setrs=nothing

%>

注册成功,点击登陆

<%

endif

%>

6,(conn.asp数据库连接文件)

<%

'连接数据库开始

dimconn,rs,sql

onerrorresumenext

dbpath=server.mappath("userinfo.mdb")

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

conn.open"PROVIDER=Microsoft.jet.OLEDB.4.0;datasource="&dbpath

'创建记录对象

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

%>

7,(userinfo.mdbACCESS数据库)

在ACCESS中建一个表,然后在这个表中建立字段名称

表名:

info

字段名称数据类型

id自动编号

username文本

password文本

sex文本

quest文本

qq文本

mail文本

personalinfo文本

ntime文本

 

(本资料素材和资料部分来自网络,仅供参考。

请预览后才下载,期待您的好评与关注!

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

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1