文档库 最新最全的文档下载
当前位置:文档库 › ASP+VB+ACCESS简单会员注册登陆系统

ASP+VB+ACCESS简单会员注册登陆系统

对ASP初学者很有用 ASP+VB+ACCESS 2000,2003 推荐环境 win 2003 +IIS 6 (大家动动手)

[以下是所有的文件和说明]



[1,]index.asp 用户登陆页面
[2,]login.asp 用户数据处理文件
[3,]change.asp 用户信息修改页面
[4,]reg.asp 新用户注册页面
[5,]addnewdata.asp 新用户注册数据处理文件
[6,]conn.asp 数据库连接文件
[7,]userinfo.mdb ACCESS 数据库




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


引用内容





会员




会员注册系统


















用户名:
密 码:

注册









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


引用内容
<%
'打开数据库判断用户是否存在,info为表名,username为字段名
set rsc=server.createobject("adodb.recordset")
sqlc="select * from info where username='"&request.Form("username")&"' and password='"&request.Form("password")&"'"
rsc.open sqlc,conn,1,1
session("username")=rsc("username")
session("password")=rsc("password")
session.Timeout=30
set rsc=nothing
response.Redirect("change.asp")
'如果用户不存在,session("username")为空
%>
3,(change.asp 用户信息修改页面)






用户信息修改页面





<%

set rsc=server.createobject("adodb.recordset")
sqlc="select * from info where username='"&session("username")&"' and password='"&session("password")&"'"
rsc.open sqlc,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")
set rsc=nothing
if nr="" then
response.Redirect("index.asp")
end if
if strcomp(nr,request.Form("password"))=0 then
response.Write("欢迎你!"&request.Form("username"))
response.Write("你是在"&vv&"注册的")
session("username")=request.Form("username")
end if


if session("username")="" then
response.Redirect("index.asp")
end if
%>


































<% if strcomp(request.QueryString("se"),"y")=0 then
session("username")=""
response.Redirect("index.asp")
end if
%>

用户名:
*
密 码:
*
性 别:
QQ:
Mail:
地 址:
介绍

退出系统


<%
if strcomp(request.QueryString("ac"),"ch")=0 then
set rs=server.createobject("adodb.recordset")
sql="select * from info where username='"&session("username")&"'"
rs.open sql,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
set rs=nothing
response.Write("修改完成!")
end if
%>



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





用户注册




用户注册

<%
=request.QueryString("msg")
%>






































用户名:
*
密码:
*
确定密码:
*
性别:
QQ:

eight="30">

Mail:
地址:
个人介绍





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






成功


<%
ac=request.QueryString("ac")
msg="注册错误信息"
if request.Form("username")="" then
msg=msg&"
"&"用户名不能为空"
end if
if strcomp(cstr(request.Form("password")),cstr(request.Form("password2")))<>0 then
msg=msg&"
"&"两次密码输入不同"
end if

if len(request.Form("password"))<6 then
msg=msg&"
"&"密码太简单"
end if

if strcomp(msg,"注册错误信息")>0 then
response.Redirect("reg.asp?msg="&msg)
end if
if ac="adduser" then
set rsc=server.createobject("adodb.recordset")
sql="select * from info where username='"&request.Form("username")&"'"
rsc.open sql,conn,1,1
ck=rsc("username")
set rsc=nothing
if ck<>"" then
msg=msg&"
"&"用户名被人注册"
response.Redirect("reg.asp?msg="&msg)
end if
dsql="select * from info where id is null"
set rs=server.createobject("adodb.recordset")
rs.open dsql,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
set rs=nothing
%>

注册成功,点击登陆

<%
end if
%>



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


<%
'连接数据库开始
dim conn,rs,sql
on error resume next
dbpath=server.mappath("userinfo.mdb")
set conn=server.createobject("adodb.connection")
conn.open "PROVIDER=Microsoft.jet.OLEDB.4.0;data source="&dbpath
'创建记录对象
set rs=server.createobject("adodb.recordset")
%>

7,(userinfo.mdb ACCESS 数据库)



引用内容在ACCESS中建一个表,然后在这个表中建立字段名称
表名:info

字段名称 数据类型
id 自动编号
username 文本
password 文本
sex 文本
quest 文本
qq 文本
mail 文本
personalinfo 文本
ntime 文本

相关文档