⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 register_user_write.asp

📁 红金羚v1.5办公自动化软件是基于大型数据库系统开发的应用系统
💻 ASP
字号:
<%@ LANGUAGE = VBScript  TRANSACTION =Requires_New%>
<%Response.Expires=0%>
<!--#include file="error.asp"-->
<!--#include file="function.asp"-->
<%
on error resume next
'检查输入内容是否是数字
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的数字!\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

'写入数据库
function write_info(fs,hm,lc,mm,facenubmer)
	dim result,id
	on error resume next
	set rs=server.CreateObject("adodb.recordset")
	rs.open "register_user_info",conn,3,2
	rs.AddNew
	if fs="on" then
		rs("number")=hm
	end if
	rs("userlc")=lc
	rs("password")=mm
	rs("faceid")=facenumber
	rs("lastrq")=now()
	rs.Update
	if err.number=0 then
		if fs="off" then
			set rs1=conn.execute("select max(id) 'maxid' from register_user_info")
			result=clng(rs1("maxid"))
			set rs1=nothing
		else
			result=hm
		end if
	else
		result=""
	end if
	rs.Close
	write_info=result
end function 

'检查数据库中是否有相同的号码
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 number 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
%>
<!--#include file="conn.asp"-->
<%
	conn.begintrans
	if fs="off" then
		hm=""
		getnumber=write_info(fs,hm,lc,mm,facenubmer)
		if getnumber<>"" then
			call mts_true()
		else
			call mts_false()
			conn.close
			call disp_error("*^_^*对不起,写入数据库错误,请再试一次!","")
		end if
	else
		if find_number(hm) then
			conn.close
			call disp_error("*^_^*对不起,该号码已经存在,请重新输入号码!","")
		else
			getnumber=write_info(fs,hm,lc,mm,facenubmer)
			if getnumber<>"" then
				call mts_true()
			else
				call mts_false()
				conn.close
				call disp_error("*^_^*对不起,写入数据库错误,请再试一次!","")
			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>")
%>
<html></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -