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

📄 enroll.asp

📁 用asp做的一个小的聊天程序
💻 ASP
字号:
<!--#include file=cn.asp-->
	<HTML><HEAD>
		<TITLE>注册</TITLE>
		<META content="EditPlus" name="Generator">
		<META content="" name="Author">
		<META content="" name="Keywords">
		<META content="" name="Description">
		
		<script language="javascript">
<!--  

  function checkvalue(theform)
  
{ if (theform.txtusername.value == "" || theform.txtusername.value.length < 1 || theform.txtusername.value.length > 10)
{ alert("用户名不能为空或用户名过长(10位以内)!");
  theform.txtusername.focus();
  return false; }
  
  for (var i=0; i < theform.txtusername.value.length; i++)
{ var pu=theform.txtusername.value.substring(i,i+1)
      if (pu == '"' || pu == "'" || pu == "<" || pu == ">")
	  { alert("用户名中有非法字符,请重新输入!");
	    theform.txtusername.focus();
	    return false; }  }
  
  if (theform.password1.value == "" || theform.password1.value.length > 10)
{ alert("密码不能为空或密码过长(10位以内)!");
  theform.password1.focus();
  return false; }
  if(theform.password1.value.length < 5)
  {alert("密码不能少于5位");
  return false;
  }

  for (var i=0; i < theform.password1.value.length; i++)
{ var pp=theform.password1.value.substring(i,i+1)
      if (pp == '"' || pp == "'" || pp == "<" || pp == ">")
	  { alert("密码中有非法字符,请重新输入!");
	    theform.password1.focus();
	    return false; }  }
	    
 if (theform.password2.value == "" || theform.password2.value.length > 10)
{ alert("密码不能为空或密码过长(10位以内)!");
  theform.password2.focus();
  return false; }
  if(theform.password2.value.length < 5)
  {alert("确认密码不能少于5位");
  return false;
  }

  for (var i=0; i < theform.password2.value.length; i++)
{ var pp=theform.password2.value.substring(i,i+1)
      if (pp == '"' || pp == "'" || pp == "<" || pp == ">")
	  { alert("密码中有非法字符,请重新输入!");
	    theform.password2.focus();
	    return false; }  }
	if (theform.password1.value!=theform.password2.value)
	{alert("两次输入的密码不一样");
	theform.password1.value="";
	theform.password2.value="";
	theform.password1.focus();
	return false;
	
	}
  
  if (theform.txtCertificate.value == "" || theform.txtCertificate.value.length < 1 || theform.txtCertificate.value.length > 18)
{ alert("证件号码为空或过长(18位以内)!");
  theform.txtCertificate.focus();
  return false; }

  for (var i=0; i < theform.txtCertificate.value.length; i++)
{ var pp=theform.txtCertificate.value.substring(i,i+1)
      if (pp == '"' || pp == "'" || pp == "<" || pp == ">")
	  { alert("证件号码中有非法字符,请重新输入!");
	    theform.txtCertificate.focus();
	    return false; }  }
	    
	if (theform.txtkey.value == "" || theform.txtkey.value.length < 1 || theform.txtkey.value.length > 18)
{ alert("回答的问题为空或过长(18位以内)!");
  theform.txtkey.focus();
  return false; }    
	    
  if (theform.txtmail.value == "" || theform.txtmail.value.length < 1 || theform.txtmail.value.length >30 )
{ alert("信箱不能为空或信箱过长(30位以内)!");
  theform.txtmail.focus();
  return false; }
  

  if (theform.txtmail.value.indexOf('@') == -1 || theform.txtmail.value.indexOf('@') == 0 || theform.txtmail.value.indexOf('@') == theform.p_email.value.length - 1)
{ alert("非法电子邮箱,请重新输入!");
  theform.txtmail.focus();
  return false; }
  
  for (var i=0; i < theform.txtmail.value.length; i++)
{ var pe=theform.txtmail.value.substring(i,i+1)
      if (pe == '"' || pe == "'" || pe == "<" || pe == ">")
	  { alert("信箱中有非法字符,请重新输入!");
	    theform.txtmail.focus();
	    return false; }  }
		
  return true;}




//-->
		</script>
	</HEAD>
	<BODY leftMargin="128" topMargin="0" align="center">
		&nbsp;
		<%
  If Request.ServerVariables("Request_Method")="POST" and trim(request("txtusername"))<>"" and trim(request("password1"))<>"" then
     g_username = trim(request("txtusername"))
     g_password1 = trim(request("password1"))
     g_password2 = trim(request("password2"))
     g_txtcer    =trim(request("txtCertificate"))
     g_sex      = trim(request("ardSex"))
     g_email    = trim(request("txtmail"))
     g_ques     =trim(request("question"))
     g_key      =trim(request("txtkey"))
	 if g_username="大家" then
	    response.write "<table align=center><tr><td><br><br>此名称已被系统占用,请换个名字再注册!<br><br><input type='button' value=' 返 回 '  onclick='javascript:history.go(-1)'><br><br></td></tr></table>"
		response.end
	 
	 else
		str="select * from leaguer where em_name='"& g_username &"'"
		rs.open str,cn,1,3
		if not rs.eof then
			response.write "<table></tr><td><br><br>用户名已存在,请选择其它用户名!<br><br><input type='button' value=' 返 回 '  onclick='javascript:history.go(-1)'><br><br></td></tr></table>"
			response.End
		else
		set rs=server.CreateObject("adodb.recordset")
			str="select * from leaguer"
			rs.open str,cn,1,3
			rs.addnew
			rs("em_name")=g_username 
			rs("em_password1")=g_password1
			rs("em_password2")=g_password2
			rs("cert_number")=g_txtcer 
			rs("sex")=g_sex
			
			rs("pormpt_pro")=g_ques
			rs("prompt_key")=g_key
			rs("e_mail")=g_email
			rs("state")=1
			rs("image")=""
			rs.update
			session("cindex")=0
			response.write "<table align=center><tr><td><br><br>恭喜, 您已注册成功!<br><form method='post' action='chat.asp'><input type='hidden' name='l_username' value="&g_username&"><input type='hidden' name='l_password' value="&g_password&"><input type='submit' value='进入聊天室'></form><br></td></tr><table>"
			application("chat")="<font color=red>[系统公告]:["& g_username &"]进入醒目聊天室,大家欢迎!</font>&nbsp;&nbsp;" &"<font color=blue>"& time &"</font><br>"
			application("person")=application("person") & "<option>" & g_username
			application("userOn")=application("userOn") & g_username & "<br>"
			
			session("username")=g_username
			response.End 
		end if
	rs.close
	set rs=nothing
	end if
	end if
	
  %>
		<IMG height="32" src="image/zc.gif" width="128"> <IMG style="WIDTH: 105px; HEIGHT: 32px" src="image/jh.gif">
		<IMG style="WIDTH: 152px; HEIGHT: 1px" height="8" src="image/hx.gif" width="31">
		<TABLE style="WIDTH: 738px; HEIGHT: 557px" cellSpacing="10" align="center">
			<FORM id="form1" name="form1" onsubmit="return checkvalue(this);" action="enroll.asp"
				method="post">
				<TBODY style="FONT-SIZE: x-small">
					<TR>
						<TD colSpan="2"><font color="red">*</font>号为必填项,请您认真填写</TD>
					</TR>
					<TR bgColor="#00ced1">
						<TD bgColor="#ccff66"><font color="red">*</font>用户名:</TD>
						<TD bgColor="#ccff66"><INPUT maxLength="10" name="txtusername">&nbsp;&nbsp;&nbsp; 
							请使用英文和数字, 并以英文开头。</TD>
					</TR>
					<TR>
						<TD><font color="red">*</font>密码:</TD>
						<TD><INPUT type="password" maxLength="12" name="password1">&nbsp;&nbsp; 请使用5--12位</TD>
					</TR>
					<TR bgColor="#00ced1">
						<TD bgColor="#ccff66"><font color="red">*</font>确认密码:</TD>
						<TD bgColor="#ccff66"><INPUT type="password" maxLength="12" name="password2">&nbsp;&nbsp;重新输入一次密码</TD>
					</TR>
					<TR>
						<TD colSpan="2"><INPUT id="Radio1" type="radio" CHECKED value="男" name="ardSex"> &nbsp;&nbsp;&nbsp; 
							男&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT id="Radio2" type="radio" value="女" name="ardSex">&nbsp;&nbsp;&nbsp;&nbsp; 
							女</TD>
					</TR>
					<TR bgColor="#00ced1">
						<TD bgColor="#ccff66"><font color="red">*</font>证件号码:</TD>
						<TD bgColor="#ccff66"><INPUT maxLength="18" name="txtCertificate">&nbsp;&nbsp; 
							请正确填写,此号码为我们给您提供服务的身份凭证,且不能修改。</TD>
					</TR>
					<TR>
						<TD><font color="red">*</font>提示问题:</TD>
						<TD><SELECT style="WIDTH: 200px" name="question">
								<OPTION value="我最喜欢的物品的名称" selected checked>我最喜欢的物品的名称</OPTION>
								<OPTION value="我最爱的电影名称">我最爱的电影名称</OPTION>
								<OPTION value="中学的校名">中学的校名</OPTION>
								<OPTION value="我最喜欢的歌曲?">我最喜欢的歌曲?</OPTION>
								<OPTION value="我最喜欢的食物?">我最喜欢的食物?</OPTION>
								<OPTION value="我的初恋日期?">我的初恋日期?</OPTION>
								<OPTION value="我妈妈的生日?">我妈妈的生日?</OPTION>
							</SELECT>&nbsp;&nbsp;请选择你的提示问题</TD>
					</TR>
					<TR bgColor="#00ced1">
						<TD bgColor="#ccff66"><font color="red">*</font>提示答案:</TD>
						<TD bgColor="#ccff66"><INPUT maxLength="18" name="txtkey">&nbsp;&nbsp;请使用4~9个中文字或8~18位英文和数字
						</TD>
					</TR>
					<TR>
						<TD><font color="red">*</font>电子邮件</TD>
						<TD><INPUT name="txtmail">&nbsp;&nbsp;请输入邮箱地址:</TD>
					</TR>
					<TR>
						<TD align="center" colSpan="2"><INPUT type="submit" value="确定">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<INPUT type="button" value="返回" onclick="location='login.asp'"></TD>
					</TR></FORM>
			</TBODY></TABLE>
	</BODY>
</HTML>

⌨️ 快捷键说明

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