?? register_user_write.asp
字號:
<%Response.Expires=0%>
<!--#include file="error.asp"-->
<!--#include file="function.asp"-->
<!--#include file="conn.asp"-->
<%
'on error resume next
'檢查輸入內(nèi)容是否是數(shù)字
function check_str(inputstr)
dim result,i,letter
result=true
for i=1 to len(inputstr)
letter=mid(inputstr,i,1)
if asc(letter)<48 or asc(letter)>57 then
result=false
exit for
end if
next
check_str=result
end function
'檢查提交表單信息是否合格
function check_form(fs,hm,lc,mm)
dim err_info
err_info=""
if fs="on" then
if hm="" then
err_info=err_info&"*^_^*號碼不能為空!\n"
else
if not check_str(hm) then
err_info=err_info&"*^_^*號碼只能輸入0~9的數(shù)字!\n"
end if
end if
end if
if lc="" then
err_info=err_info&"*^_^*昵稱不能空!\n"
end if
if mm="" then
err_info=err_info&"*^_^*密碼不能空!\n"
end if
check_form=err_info
end function
'寫入數(shù)據(jù)庫
function write_info(fs,hm,lc,mm,facenubmer)
dim result,id
if fs="on" then
sql="insert into register_user_info ([number],userlc,password,faceid) values"
sql=sql & "(" & hm & ",'" & charfilter(lc) & "','" & replace(mm,"'","''") & "'," & facenumber & ")"
Conn.Execute(sql)
If Err.Number=0 Then
result=hm
Else
result=""
End If
else
sql="insert into register_user_info (userlc,password,faceid,lastrq) values"
sql=sql & "('" & charfilter(lc) & "','" & replace(mm,"'","''") & "'," & facenumber & ",now())"
Conn.Execute(sql)
if Err.Number<>0 Then
result=""
Else
set rs1=conn.execute("select @@identity as maxid from register_user_info")
result=clng(rs1("maxid"))
rs1.close
set rs1=nothing
End If
end if
'Conn.Close
write_info=result
end function
'檢查數(shù)據(jù)庫中是否有相同的號碼
function find_number(hm)
dim result,sql,monthstr,daystr,monthint,dayint
if clng(hm)<=100000 then
result=true
elseif clng(hm)>=19700101 and clng(hm)<=19861231 then
monthstr=mid(hm,5,2)
daystr=mid(hm,7,2)
monthint=clng(monthstr)
dayint=clng(daystr)
if monthint>=1 and monthint<=12 and dayint>=1 and dayint<=31 then
result=true
else
result=false
end if
else
set rs=server.CreateObject ("adodb.recordset")
sql="select id from register_user_info where [number]="&hm&" or (id="&hm&" and [number] IS NULL)"
rs.open sql,conn,1,1
if rs.eof or rs.bof then
result=false
else
result=true
end if
rs.close
end if
find_number=result
end function
dim fs,hm,lc,mm,facenumber,errorinfo,sql,getnubmer
fs=Request.Form("fs")
hm=trim(Request.Form("hm"))
lc=trim(Request.Form("lc"))
mm=trim(Request.Form("mm"))
facenumber=Request.Form("facenumber")
errorinfo=""
errorinfo=check_form(fs,hm,lc,mm)
if errorinfo<>"" then
call disp_error(errorinfo,"")
else
%>
<%
conn.begintrans
if fs="off" then
hm=""
getnumber=write_info(fs,hm,lc,mm,facenubmer)
if getnumber<>"" then
conn.commitTrans
else
conn.rollbacktrans
conn.close
call disp_error("*^_^*對不起,寫入數(shù)據(jù)庫錯誤,請再試一次!","")
end if
else
if find_number(hm) then
conn.committrans
conn.close
call disp_error("*^_^*對不起,該號碼已經(jīng)存在,請重新輸入號碼!","")
else
getnumber=write_info(fs,hm,lc,mm,facenubmer)
if getnumber<>"" then
conn.committrans
else
conn.rollbacktrans
conn.close
call disp_error("*^_^*對不起,寫入數(shù)據(jù)庫錯誤,請再試一次!2","")
end if
end if
end if
end if
application.lock
onlineuser=application("onlineuser"&session("siteid"))
killflag=0
dimsums=ubound(onlineuser)
for i=0 to dimsums
if instr(onlineuser(i),cstr(session.sessionID)&"$")>0 then
infostr=split(onlineuser(i),"$")
infostr(1)=lc
if session("manager")<>"1" then
infostr(2)="2"
end if
infostr(5)=facenumber
onlineuser(i)=infostr(0)&"$"&infostr(1)&"$"&infostr(2)&"$"&infostr(3)&"$"&infostr(4)&"$"&infostr(5)
killflag=1
exit for
end if
next
application("onlineuser"&session("siteid"))=onlineuser
if session("manager")="1" then
onlinemanager=application("onlinemanager")
killflag1=0
dimsums=ubound(onlinemanager)
for i=0 to dimsums
if instr(onlinemanager(i),cstr(session.sessionID))>0 then
infostr=split(onlinemanager(i),"$")
infostr(2)=lc
infostr(7)=facenumber
onlinemanager(i)=infostr(0)&"$"&infostr(1)&"$"&infostr(2)&"$"&infostr(3)&"$"&infostr(4)&"$"&infostr(5)&"$"&infostr(6)&"$"&infostr(7)
killflag1=1
exit for
end if
next
application("onlinemanager")=onlinemanager
end if
if isempty(session("manager")) or session("manager")="" then
session("manager")="2"
end if
session("username")=lc
if killflag=0 then
call write_online_user(session("siteid"),facenumber)
end if
application.unlock
Response.Write("<html>")
Response.Write("<head>")
Response.Write("<title>注冊成功</title>")
Response.Write("<meta http-equiv=""pragma"" content=""no-cache"">")
Response.Write("<meta http-equiv=""Content-Type"" content=""text/html;charset=gb2312"">")
response.write("<link rel=""stylesheet"" type=""text/css"" href=""style.css"">")
Response.Write("</head>")
Response.Write("<body bgcolor=#8482c6>")
Response.Write("<br><p align=""left""><font color=""#ffffff"">注冊成功!</font><br><br><font color=""#ffffff"">")
Response.Write("號碼:"&getnumber&"<br>")
Response.Write("昵稱:"&lc&"<br>")
Response.Write("密碼:"&mm&"<br>")
Response.Write("請牢記您的注冊信息!")
Response.Write("</font><br>")
Response.Write("<script language=""javascript"">")
Response.Write("parent.faceid.value="&chr(34)&facenumber&chr(34)&";")
Response.Write("parent.username.value="&chr(34)&lc&chr(34)&";")
Response.Write("parent.usernoid.value="&chr(34)&getnumber&chr(34)&";")
Response.Write("parent.userregisterflag.value=""1"";")
Response.Write("parent.refflag.value=""1"";")
Response.Write("</script>")
Response.Write("</body></html>")
%>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -