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

📄 adduser.asp

📁 同学录的设计
💻 ASP
📖 第 1 页 / 共 2 页
字号:
      <TD height="25" align=center> <p>头像大小: </TD>
      <TD height="25"> 宽: 
        <input name=Form_FaceWidth class=fminpt id="txl_FaceWidth" onChange="javascript:changeface2();" value="32" size=3 >
        (<%=facewidthmin%>-<%=facewidthmax%>) 高: 
        <input  name=Form_FaceHeight class=fminpt id="txl_FaceHeight" onchange="javascript:changeface2();" value="32" size=3 >
        (<%=faceheightmin%>-<%=faceheightmax%>) </TD>
    </TR>
    <TR> 
      <TD height="25" align=center> <p>你的生日: </TD>
      <TD height="25" align="left"> <p> 
          <select name="txl_byear" id="txl_byear">
            <% dim selected
		  for i=1950 to 2003
		  		if i=1980 then
					selected="selected"
				else
					selected=""
				end if
				Response.Write("<option value='"&i&"' "&selected&">"&i&"</option>")
			 next	  
		   %>
          </select>
          <select name="txl_bmonth" id="txl_bmonth">
            <%for i=1 to 12
				Response.Write("<option value='"&i&"'>"&i&"</option>")
			 next%>
          </select>
          <select name="txl_bday" id="select2">
            <%for i=1 to 31
				Response.Write("<option value='"&i&"'>"&i&"</option>")
			 next%>
          </select>
          日</TD>
    </TR>
    <TR> 
      <TD height="25" align=center> <p>签名-UBB: </TD>
      <TD height="25" valign="baseline"> <textarea name=txl_Underwrite cols=34 rows=5 class=fmtxtra id="textarea"></textarea>
        (<font color="gray">255字符内</font>) </TD>
    </TR>
    <TR> 
      <TD height="25" align=center>新用户注册邮件通知:</TD>
      <TD height="25"><input type="radio" name="new_reg_mail_inform" value="1">
        通知 
        <input name="new_reg_mail_inform" type="radio" value="0" checked>
        不要通知</TD>
    </TR>
    <TR>
      <TD height="25" align=center>用户类型:</TD>
      <TD height="25">
	  <select name="usertype" id="usertype">
          <option value="1" selected>班级好友</option>
          <option value="2">准班级成员</option>
          <option value="3">班级成员</option>
          <option value="4">班级嘉宾</option>
        </select></TD>
    </TR>
    <TR> 
      <TD height="25" align=center><input name="send" type="submit" id="send" style="border:1px solid #666666;height:20px;" onFocus="this.blur()" value="注册"></TD>
      <TD height="25"><input type="reset" name="Submit32" value="重写" style="border:1px solid #666666;height:20px;" onFocus="this.blur()"></TD>
    </TR>
  </TABLE>
</form>
<%End Sub%>
<%
Function DisplayFaceSelect
	dim i,rs,faceurl
	on error resume next
	set rs=conn.execute ("select faceurl from config where id=1")
	faceurl=rs(0)
	rs.close
	set rs=nothing
	faceurl=Split(faceurl,"|")
	for i=0 to ubound(faceurl)-1
			Response.write "<option value='"&const_FaceUploadurl&faceurl(i)&"'>"&const_FaceUploadurl&faceurl(i)&"</option>"
	next
End Function

Function checkusername(username)
	dim rs
	set	rs=conn.execute ("select studentid from ec where studentid='"&username&"'")
	if not rs.eof then
		checkusername=false	'已经被注册
	else
		checkusername=true	'没有被注册
	end if
End Function

SUb addsave
dim username,password,email,truename,question,answer
	dim oicq,homephone,homeaddr,homezip,newphone,newaddr
	dim newzip,sex,userpic,FaceUrl,FaceWidth,FaceHeight
	dim byear,bmonth,bday,ubbsign
	
	username=Trim(Request.Form("txl_username"))
	
	If not checkfrmusername(username) Then
		Call printerror ("新增用户出错","<li>"&GBL_CHK_TempStr&"</li>",779)
		Exit SUb
	End IF
	
	If not checkusername(username) Then
		Call printerror ("新增用户出错","<li>"&username&"已经被注册</li>",779)
		Exit SUb
	End IF
	password=Trim(Request.Form("txl_password1"))
	email=Trim(Request.Form("txl_email"))
	truename=Trim(Request.Form("txl_truename"))
	question=htmlEncode(Trim(Request.Form("txl_question")))
	answer=htmlEncode(Trim(Request.Form("txl_answer")))

	oicq=Trim(Request.Form("txl_oicq"))
	homephone=Trim(Request.Form("txl_homephone"))
	homeaddr=Trim(Request.Form("txl_homeaddr"))
	homezip=Trim(Request.Form("txl_homezip"))
	newphone=Trim(Request.Form("txl_newphone"))
	newaddr=Trim(Request.Form("txl_newaddr"))
	newzip=Trim(Request.Form("txl_newzip"))
	sex=Trim(Request.Form("txl_sex"))
	userpic=Trim(Request.Form("txl_userpic"))
	FaceUrl=Trim(Request.Form("txl_FaceUrl"))
	FaceWidth=Trim(Request.Form("Form_FaceWidth"))
	FaceHeight=Trim(Request.Form("Form_FaceHeight"))
	byear=Trim(Request.Form("txl_byear"))
	bmonth=Trim(Request.Form("txl_bmonth"))
	bday=Trim(Request.Form("txl_bday"))
	ubbsign=htmlEncode(Trim(Request.Form("txl_Underwrite")))
	dim rs
	set rs=Server.CreateObject("Adodb.Recordset")
	rs.open "select * from ec where 1=2",conn,1,3
	rs.addnew()
		rs("studentid")=username
		rs("password")=password
		rs("sname")=truename
		rs("sex")=sex
		rs("oicq")=oicq
		rs("email")=email
		rs("homephone")=homephone
		rs("homeaddr")=homeaddr
		rs("homezip")=homezip
		rs("newphone")=newphone
		rs("newaddr")=newaddr
		rs("newzip")=newzip
		rs("pwdquest")=question
		rs("pwdanswer")=answer
		rs("logintimes")=0
		rs("pic")=FaceUrl
		rs("forumtimes")=0
		rs("lastedtime")=now()
		rs("birthday")=byear&"-"&bmonth&"-"&bday
		rs("picwidth")=Clng(FaceWidth)
		rs("picheight")=Clng(FaceHeight)
		rs("sign")=ubbsign
		rs("usertype")=Session("usertype")
		rs("picurl")=FaceUrl
		rs("new_reg_mail_inform")=Request.Form("new_reg_mail_inform")
		rs("usertype")=Request.Form("usertype")
	rs.update
	rs.close
	set rs=nothing
	Call printsuc ("恭喜您,注册成功","<li>对用户"&username&"的添加已经成功!<li>",779)
End SUb
function checkfrmusername(username)
	dim Form_UserName,badword,GBL_CHK_Flag,Loop_N,TempURL
	GBL_CHK_Flag=1
	Form_UserName=Trim(username)
	if Form_UserName="" or isnull(Form_UserName) or isempty(Form_UserName) then 
		GBL_CHK_TempStr="用户名不能为空或者有非法的字符"
		checkfrmusername=false
		exit function
	end if
	Dim TempChar
	TempURL = Len(Form_UserName)
	For Loop_N = 1 to TempURL
	TempChar = ASC(Mid(Form_UserName,Loop_N,1))
		If TempChar < 0 Then TempChar = TempChar + 65535
		If TempChar < 45 or (TempChar>45 and TempChar<48) or (TempChar>57 and TempChar<65) or (TempChar>90 and TempChar < 95) or TempChar = 96 or (TempChar > 122 and TempChar < 33088) Then
			GBL_CHK_TempStr = "用户名含有非法字符(请使用数字,字母,下划线)!<br>"
			GBL_CHK_Flag = 0
			Exit Function
		End If
		
		If TempChar > 65184 Then
			GBL_CHK_TempStr = "非法的用户名,含有非法字符,请确认!<br>"
			GBL_CHK_Flag = 0
			Exit Function
			End If
	next
	
	If inStr(Form_UserName,"'")>0 or inStr(Form_UserName,"’")>0  or inStr(Form_UserName,"“")>0 or inStr(Form_UserName,"”")>0then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含'或“或”或 "& chr(34) & "符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	If inStr(Form_UserName,"`")>0 or inStr(Form_UserName,"~")>0 or inStr(Form_UserName,"&")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含`或&符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	If inStr(Form_UserName,"!")>0 or inStr(Form_UserName,"@")>0 or inStr(Form_UserName,"^")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含!@^符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName,"#")>0 or inStr(Form_UserName,"$")>0 or inStr(Form_UserName,"%")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含#$%符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName,"*")>0 or inStr(Form_UserName,"(")>0 or inStr(Form_UserName,")")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含*()符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName,"+")>0 or inStr(Form_UserName,"=")>0 or inStr(Form_UserName,"|")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含+=|符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName," ")>0 or inStr(Form_UserName,chr(10))>0 or inStr(Form_UserName,chr(13))>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含空格,换行等符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName,chr(127))>0 or inStr(Form_UserName,chr(9))>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含制表符等符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName,"[")>0 or inStr(Form_UserName,"]")>0 or inStr(Form_UserName,"\")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含[]\等符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName,"{")>0 or inStr(Form_UserName,"}")>0 or inStr(Form_UserName,";")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含{};等符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName,":")>0 or inStr(Form_UserName,",")>0 or inStr(Form_UserName,".")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含:,.等符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If
	
	If inStr(Form_UserName,"<")>0 or inStr(Form_UserName,">")>0 or inStr(Form_UserName,"/")>0 or inStr(Form_UserName,"?")>0 then
		GBL_CHK_TempStr = GBL_CHK_TempStr & "用户名不能包含<>?/等符号!<br>"
		GBL_CHK_Flag = 0
		Exit Function
	End If

	if GBL_CHK_Flag=0 then
		 checkfrmusername=false
	else
		checkfrmusername=true
	end if
end function
%>

⌨️ 快捷键说明

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