《ASP用戶登錄注冊代碼》由會員分享,可在線閱讀,更多相關(guān)《ASP用戶登錄注冊代碼(10頁珍藏版)》請?jiān)谘b配圖網(wǎng)上搜索。
1、ASP用戶登錄注冊代碼
1,(index.asp 用戶登陸頁面)
會員
2、
會員注冊系統(tǒng)
2,(login.asp 用戶數(shù)據(jù)處理文件)
<%
'打開數(shù)據(jù)庫判斷用戶是否存在,info為表名,username為字段名
set rsc=server.createobject("adodb.recordset")
sqlc="select * from info where username='"&request.Form("username")&"' and password='"&request.Form("
5、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 用戶信息修改頁面)
6、eta http-equiv="Content-Type" content="text/html; charset=gb2312">
修改
<%
set rsc=server.createobject("adodb.recordset")
sqlc="select * from info where username='"&sess
7、ion("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="" the
8、n
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
%>
9、
<%
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")=reques
14、t.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
%>
15、body>
4,(reg.asp 新用戶注冊頁面)
用戶注冊
用戶注冊
<%
=re
16、quest.QueryString("msg")
%>
5,(addnewdata.asp 新用
20、戶注冊數(shù)據(jù)處理文件)
成功
<%
ac=request.QueryString("ac")
msg="注冊錯(cuò)誤信息"
if request.Form("username")="" then
msg=msg&"
"&"用戶名不能為空"
end if
if strcomp(c
21、str(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,"注冊錯(cuò)誤信息")>0 then
response.Redirect("reg.asp?msg="&msg)
end if
if ac="adduser" then
set rsc=server
22、.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"
s
23、et 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("personalin
24、fo")=request.Form("personalinfo")
rs("ntime")=now
rs.update
set rs=nothing
%>
注冊成功,點(diǎn)擊登陸
<%
end if
%>
6,(conn.asp 數(shù)據(jù)庫連接文件)
<%
'連接數(shù)據(jù)庫開始
dim conn,rs,sql
on error resume next
dbpath=server.mappath("userinfo.mdb
25、")
set conn=server.createobject("adodb.connection")
conn.open "PROVIDER=Microsoft.jet.OLEDB.4.0;data source="&dbpath
'創(chuàng)建記錄對象
set rs=server.createobject("adodb.recordset")
%>
7,(userinfo.mdb ACCESS 數(shù)據(jù)庫)
在ACCESS中建一個(gè)表,然后在這個(gè)表中建立字段名稱
表名:info
字段名稱 數(shù)據(jù)類型
id 自動(dòng)編號
username 文本
password 文本
sex 文本
quest 文本
qq 文本
mail 文本
personalinfo 文本
ntime 文本
?