fill_reg.asp

来自「大家好」· ASP 代码 · 共 286 行

ASP
286
字号
<%@ Language=VBScript %>
<%
	username=Session("username")
	if username="" then
		Response.Redirect "syspages\error_InvalidRequest.htm"
	end if
	'再次检验是否有此用户名
	ON ERROR RESUME NEXT
	strSql="SELECT * FROM yonghu WHERE yonghu='"+username+"'"
	Set con=Server.CreateObject("ADODB.Connection")
	Set rs=Server.CreateObject("ADODB.RecordSet")
	con.Open Application("DBCon_ConnectionString")
	Set rs=con.Execute(strSql) 
	if not rs.EOF then'有
		Response.Redirect "member_reg.asp?username="+username
	end if
	con.Close
%>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function form_reg_onsubmit() {
	var form=document.form_reg;
	return(check(form));
}
function check(form)
{
  if (form.password.value.length<1)
  {
    alert("请您输入密码!");
    form.password.focus();
    return (false);
  }
  if (form.re_password.value.length<1)
  {
    alert("请您输入确认密码!");
    form.re_password.focus();
    return (false);
  }
  if (form.re_password.value!=form.password.value)
  {
    alert("两次输入的密码不一样!");
    form.password.focus()
    return (false);
  }
  if(form.danwei.value.length<=0)
  {        
	window.alert("单位名称不能为空!");
	form.danwei.focus();
	return false;
  }
  if(form.guojia.value.length<=0)
  {        
	window.alert("请输入国家名称!");
	form.guojia.focus();
	return false;
  }
  if(form.chengshi.value.length<=0)
  {        
	window.alert("城市名称不能为空!");
	form.chengshi.focus();
	return false;
  }
    if(form.youbian.value.length>0)
    {
	   if(!check_ecode(form.youbian))
	   {
		return false;
	   }
	return ture;
	}
  if(!check_mail(form.e_mail.value) && form.e_mail.value.length>0)
  {
	alert("您输入的E-mail地址有误!请更正!^_^");
	form.e_mail.focus();
	return(false);
  }
	if(form.zhuye.value.length>0)
	{
   		if(!check_zhuye(form.zhuye.value))
   		{
			alert("请核查您的主页地址.");
			form.zhuye.focus();
			return false;
   		}
   	   return (true);
   	}
}

function check_ecode(code)
{
	if (code.value!="")
	{
		if (check_int(code.value))
		{
			if (code.value.length>6)
			{
				alert("邮政编码必须小于等于6位!");
				code.focus();
				return(false);
			}
			return true;
		} 
		else
		{
			alert("邮政编码必须为数字!");
			code.focus();
			return(false);		
		}
	}
	return false;
}
function check_zhuye(page)
{
	var checkOK = ".";
	var valid=false;
	var num=0;
	if(page.charAt(page.length-1)==checkOK)
		return false;
	for(i=0;i<page.length;i++)
	{
		ch=page.charAt(i);
		if(ch==checkOK)	 num++;
	}
	if(num>1) return true;
	return false;
		
}
function check_mail(myint)
{
  var checkOK = "@";
  var checkStr = myint;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";

if(checkStr.charAt(0)=='@') return(false);
if(checkStr.charAt(checkStr.length-1)=='@')
return(false);
if(checkStr.charAt(checkStr.length-1)=='.')
return(false);
a_valid=0; a_count=0;
d_valid=0;
 for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    if (ch == '@')   {a_valid=1; a_count++;  }
    if (ch == '.')   {d_valid=1;  }
  }
   if(a_count>1) return(false);
   if(a_valid==1 && d_valid==1) return(true); else return(false);
}

function check_int(myint)
{

  var checkOK = "0123456789-";
  var checkStr = myint;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    return (false);
  }

  return (true);
}
//--></script>
<link rel="stylesheet" href="../html/3508.css">
<style type="text/css">
<!--
.type1 {  font-size: 12px; color: #000000; background-color: #FFFFE8}
-->
</style>
</HEAD>
<BODY background="../images/bg1.gif">
<table width="740" border="0" cellspacing="0" cellpadding="0" align="center" height="40">
  <tr> 
    <td width="217" height="39" align="center" valign="bottom"><img src="../images/smallmark.gif" width="120" height="25"></td>
    <td width="523" valign="bottom" height="39"><a href="../default.asp">本站首页</a> 
      &gt;&gt; 会员注册</td>
  </tr>
  <tr> 
    <td colspan="2" height="1" bgcolor="006600"></td>
  </tr>
</table>
<form name=form_reg method="post" action="add_member.asp" LANGUAGE=javascript onsubmit="return form_reg_onsubmit()">
  <p align="center">请填写用户的相关资料,带&quot;*&quot;号的必须填写</p>
  <table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
      <td width="12%">*口  令: </td>
      <td width="88%"> 
        <input id=password name=password type=password class="type1" size="8" maxlength="8">
      </td>
    </tr>
    <tr> 
      <td width="12%">*确认口令:</td>
      <td width="88%"> 
        <input id=password2 name=re_password 
type=password class="type1" size="8" maxlength="8">
      </td>
    </tr>
    <tr> 
      <td width="12%">*单位名称:</td>
      <td width="88%"> 
        <input id=danwei name=danwei class="type1" size="40" maxlength="40">
      </td>
    </tr>
    <tr> 
      <td width="12%">国  家:</td>
      <td width="88%"> 
        <input id=guojia name=guojia class="type1" size="12" value="中国" maxlength="20">
        </td>
    </tr>
    <tr> 
      <td width="12%">城  市:</td>
      <td width="88%"> 
        <input id=chengshi 
name=chengshi class="type1" size="16" value="<% if session("city")<>"all" then%><%=session("city")%><%end if%>" maxlength="16">
      </td>
    </tr>
    <tr> 
      <td width="12%">地  址:</td>
      <td width="88%"> 
        <input id=dizhi name=dizhi class="type1" size="60" maxlength="80">
      </td>
    </tr>
    <tr> 
      <td width="12%">邮  编:</td>
      <td width="88%"> 
        <input 
id=youbian name=youbian class="type1" size="12" maxlength="10">
      </td>
    </tr>
    <tr> 
      <td width="12%">联 系 人:</td>
      <td width="88%"> 
        <input id=lianxiren name=lianxiren class="type1" size="12" maxlength="10">
      </td>
    </tr>
    <tr> 
      <td width="12%" height="30">联系电话:</td>
      <td width="88%" height="30"> 
        <input id=dianhua name=dianhua class="type1" size="40" maxlength="40">
      </td>
    </tr>
    <tr> 
      <td width="12%"> E-mail:</td>
      <td width="88%"> 
        <input id=e_mail name=e_mail class="type1" size="38" maxlength="35">
      </td>
    </tr>
    <tr> 
      <td width="12%"> 主  页:</td>
      <td width="88%"> 
        <input id=zhuye name=zhuye class="type1" size="30" maxlength="30">
      </td>
    </tr>
    <tr align="center"> 
      <td colspan="2" height="80"> 
        <input id=reset1 name=reset1 type=reset value=重填 class="type1">   <input id=submit1 name=submit1 type=submit value=确定 class="type1">
      </td>
    </tr>
  </table>
  </form>
<!-- #include file="../include/end.htm" -->
</BODY>
</HTML>

⌨️ 快捷键说明

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