资源描述
管理员登录系统 第一!1,(index.asp 用户登陆页面)!- #include file=conn.asp -!- 悠悠长假期 -htmlheadmeta http-equiv=Content-Type content=text/html; charset=gb2312title会员/titlestyle type=text/css!-body,td,th font-family: 宋体; font-size: 14px;-/style/headbodycenterp会员注册系统/pform name=form1 method=post action=login.asptable width=34% border=0trtd width=33% height=30用户名:/tdtd width=67% height=30input name=username type=text id=username size=15/td/trtrtd height=30密 码:/tdtd height=30input name=password type=password id=password size=15/td/trtrtd colspan=2 align=centerinput type=submit name=Submit value=确定input type=reset name=Submit value=重置/td/trtrtd colspan=2a href=reg.asp target=_self注册/a/td/tr/table/form/center/body/html2,(login.asp 用户数据处理文件) !- #include file=conn.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,1session(username)=rsc(username)session(password)=rsc(password)session.Timeout=30set rsc=nothingresponse.Redirect(change.asp)如果用户不存在,session(username)为空%3,(change.asp 用户信息修改页面)!- #include file=conn.asp -htmlheadmeta http-equiv=Content-Type content=text/html; charset=gb2312title修改/titlestyle type=text/css!-body,td,th font-size: 14px;-/style/headcenterbodybr%set rsc=server.createobject(adodb.recordset)sqlc=select * from info where username=session(username) and password=session(password)rsc.open sqlc,conn,1,1nr=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=nothingif nr= thenresponse.Redirect(index.asp)end ifif strcomp(nr,request.Form(password)=0 thenresponse.Write(欢迎你!request.Form(username)response.Write(你是在vv注册的)session(username)=request.Form(username)end ifif session(username)= thenresponse.Redirect(index.asp)end if%form name=form1 method=post action=change.asp?ac=chtable width=39% height=105 border=0 trtd width=27% height=30用户名:/tdtd width=73% height=30input name=username type=text id=username value=%=username%*/td/trtrtd height=30密nbsp; 码:/tdtd height=30input name=password type=text id=password value=%=password%*/td/trtrtd height=30性nbsp; 别:/tdtd height=30input name=sex type=text id=sex value=%=sex%/td/trtrtd height=30QQ:/tdtd height=30input name=qq type=text id=qq value=%=qq%/td/trtrtd height=30Mail:/tdtd height=30input name=mail type=text id=mail value=%=mail%/td/trtrtd height=30地nbsp; 址:/tdtd height=30input name=add type=text id=add value=%=add%/td/trtrtd介绍/tdtdtextarea name=personalinfo cols=30 rows=6 id=personalinfo%=personalinfo%/textarea/td/trtrtd /tdtdinput type=submit name=Submit value=修改a href=change.asp?se=y target=_self退出系统/a/tdnbsp; % if strcomp(request.QueryString(se),y)=0 thennbsp; session(username)=nbsp; response.Redirect(index.asp)nbsp; end ifnbsp; %/tr/table/form%if strcomp(request.QueryString(ac),ch)=0 thenset rs=server.createobject(adodb.recordset)sql=select * from info where username=session(username)rs.open sql,conn,1,3rs(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.updateset rs=nothingresponse.Write(修改完成!)end if%/body/center/html4,(reg.asp 新用户注册页面)htmlheadmeta http-equiv=Content-Type content=text/html; charset=gb2312title用户注册/titlestyle type=text/css!-body,td,th font-family: 宋体; font-size: 14px;-/style/headbodycenter用户注册br%=request.QueryString(msg)%form name=form1 method=post action=addnewdata.asp?ac=addusertable width=39% height=105 border=0 trtd width=27% height=30用户名:/tdtd width=73% height=30input name=username type=text id=username*/td/trtrtd height=30密码:/tdtd height=30input name=password type=password id=password*/td/trtrtd height=30确定密码:/tdtd height=30input name=password2 type=password id=password2*/td/trtrtd height=30性别:/tdtd height=30input name=sex type=text id=sex/td/trtrtd height=30QQ:/tdtd height=30input name=qq type=text id=qq/td/trtrtd height=30Mail:/tdtd height=30input name=mail type=text id=mail/td/trtrtd height=30地址:/tdtd height=30input name=add type=text id=add/td/trtrtd个人介绍/tdtdtextarea name=personalinfo cols=30 rows=6 id=personalinfo/textarea/td/trtrtd /tdtdinput type=submit name=Submit value=提交/td/tr/table/form/center/body/html5,(addnewdata.asp 新用户注册数据处理文件)!- #include file=conn.asp -htmlheadmeta http-equiv=Content-Type content=text/html; charset=gb2312title成功/title/headbody%ac=request.QueryString(ac)msg=注册错误信息if request.Form(username)= thenmsg=msgbr用户名不能为空end ifif strcomp(cstr(request.Form(password),cstr(request.Form(password2)0 thenmsg=msgbr两次密码输入不同end if if len(request.Form(password)6 thenmsg=msgbr密码太简单end if if strcomp(msg,注册错误信息)0 thenresponse.Redirect(reg.asp?msg=msg)end ifif ac=adduser thenset rsc=server.createobject(adodb.recordset)sql=select * from info where username=request.Form(username)rsc.open sql,conn,1,1ck=rsc(username)set rsc=nothingif ck thenmsg=msgbr用户名被人注册response.Redirect(reg.asp?msg=msg)end ifdsql=select * from info where id is nullset rs=server.createobject(adodb.recordset)rs.open dsql,conn,1,3rs.addnewrs(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)=nowrs.updateset rs=nothing%centera href=index.asp target=_self注册成功,点击登陆/a/center%end if%/body/html6,(conn.asp 数据库连接文件)%连接数据库开始dim conn,rs,sqlon error resume nextdbpath=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 文本
展开阅读全文