 <!--#include file="md5.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="setup.asp"-->
<%dim action
action=request.QueryString("action")%>
<html>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<title><%=site_name%>--新用户注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language=JavaScript>
<!--
function checkuserinfo()
{
   if(checkspace(document.userinfo.user.value)) {
	document.userinfo.user.focus();
    alert("对不起，请填写用户名！");
	return false;
  }
    if(checkspace(document.userinfo.pass.value) || document.userinfo.pass.value.length < 6 || document.userinfo.pass.value.length >20) {
	document.userinfo.pass.focus();
    alert("密码长度不能不能这空，在6位到20位之间，请重新输入！");
	return false;
  }
    if(document.userinfo.pass.value != document.userinfo.pass1.value) {
	document.userinfo.pass.focus();
	document.userinfo.pass.value = '';
	document.userinfo.pass1.value = '';
    alert("两次输入的密码不同，请重新输入！");
	return false;
  }
 if(document.userinfo.email.value.length!=0)
  {
    if (document.userinfo.email.value.charAt(0)=="." ||        
         document.userinfo.email.value.charAt(0)=="@"||       
         document.userinfo.email.value.indexOf('@', 0) == -1 || 
         document.userinfo.email.value.indexOf('.', 0) == -1 || 
         document.userinfo.email.value.lastIndexOf("@")==document.userinfo.email.value.length-1 || 
         document.userinfo.email.value.lastIndexOf(".")==document.userinfo.email.value.length-1)
     {
      alert("Email地址格式不正确！");
      document.userinfo.email.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空！");
   document.userinfo.email.focus();
   return false;
   }
   if(checkspace(document.userinfo.name.value)) {
	document.userinfo.name.focus();
    alert("对不起，请填写真实姓名！");
	return false;
  }
  if(checkspace(document.userinfo.youbian.value)) {
	document.userinfo.youbian.focus();
    alert("对不起，请填写邮编！");
	return false;
  }
  if(document.userinfo.youbian.value.length!=6) {
	document.userinfo.youbian.focus();
    alert("对不起，请正确填写邮编！");
	return false;
  } 
    if(checkspace(document.userinfo.tel.value)) {
	document.userinfo.tel.focus();
    alert("对不起，请填写电话号码！");
	return false;
  } 
       }
/*function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}*/
//-->
</script>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >
<TABLE cellSpacing=0 cellPadding=0 width=98% align=center border=0>
      <TBODY>
        <TR>
          <TD class=b vAlign=top align=left><br>
              <%select case action
case ""%>
              <table width="95%" align="center" border="0" cellspacing="0" cellpadding="0"  bordercolor="#CCCCCC">
                <tr>
                  <td height="22" bgcolor="#FFFFFF" bordercolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
                      <tr>
                        <td valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr>
                              <td><table width="80%" align="center" border="0" cellspacing="0" cellpadding="0">
                                  <tr>
                                    <td height="40" align="center"><font color=red><strong>请用户仔细阅读天缘学校网站系统注册条约</strong></font></td>
                                  </tr>
                              </table></td>
                            </tr>
                            <tr>
                              <td><table width="80%" border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#E2F1FC">
                                  <tr bgcolor="#ffffff">
                                    <td><%call tiaoyue()%>                                    </td>
                                  </tr>
                              </table></td>
                            </tr>
                          </table>
                            <table name=agree border="0" cellpadding="10" cellspacing="0" align=center width="80%">
                              <tr align=center>
                                <td width="50%" align="right"><FORM name=register method=post action=register.asp?action=yes>
                                    <INPUT class="go-wenbenkuang" type=submit value=" 同意注册 " name=Submit>
                                </FORM></td>
                                <td width="50%" align="left"><FORM action=index.asp method=post>
                                    <INPUT name="submit" type=submit class=go-wenbenkuang value=" 我不同意 ">
                                </FORM></td>
                              </tr>
                          </table></td>
                      </tr>
                  </table></td>
                </tr>
              </table>
              <%case "yes"%>
              <table width="95%" align="center" border="0" cellspacing="0" cellpadding="0"  bordercolor="#CCCCCC">
                <tr>
                  <td bgcolor="#FFFFFF" bordercolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td align="center"><p><font color="#FF3300"><b>请您详细填写您的信息<br>
                      您的个人信息对外保密。(带 <font color=red>**</font> 号为必填项) </b></font></p>
                            <form name=userinfo method=post action=register.asp?action=save>
                              <table width="85%" border="0" cellpadding="2" cellspacing="1" bgcolor="#6293D5" align="center">
                                <tr>
                                  <td height=15 colspan=2 bgcolor="#E2F1FC"><font color="#FF3300">* 用户名和密码</font> </td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align=right>用 户 名：</td>
                                  <td width=83% class=pad><input class="wenbenkuang" name="user" type="text" id="user" maxLength="18">
                                      <font color=red>**</font>用户名长度不能小于2支持中文</td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align=right>密　　码：</td>
                                  <td class=pad><input class="wenbenkuang" name="pass" type="password" id="pass" maxLength="18">
                                      <font color=red>**</font>长度必须大于6个字符</td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align=right>确认密码：</td>
                                  <td class=pad><input class="wenbenkuang" name="pass1" type="password" id="pass1" maxLength="18">
                                      <font color=red>**</font></td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align=right>电子邮箱：</td>
                                  <td class=pad><font color=red>**</font></td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td align=right>密码问题：</td>
                                  <td class=pad><input class="wenbenkuang" name="quesion" type="text" id="quesion">
                            忘记密码的提示问题</td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td align=right>问题答案：</td>
                                  <td class=pad><input class="wenbenkuang" name="answer" type="text" id="answer">
                            忘记密码的问题答案</td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td colspan="2" valign="middle" bgcolor="#E2F1FC"><font color="#FF3300">* 用户详细资料</font></td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align=right>您的真实姓名：</td>
                                  <td class=pad><input class="wenbenkuang" name="name" type="text" id="name" size="10">
                                      <font color=red>**</font> 以便发货确认 </td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align=right>姓　　别：</td>
                                  <td class=pad><input type=radio name=babysex id=Select1 value=0 checked>
                            男
                              <input type=radio name=babysex id=Select1 value=1>
                            女 </td>
                                </tr>
                                
                                
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align=right>邮　　编：</td>
                                  <td class=pad><input class="wenbenkuang" name="youbian" type="text" id="youbian" maxlength="6" size="10" onKeyPress="event.returnValue=IsDigit();">
                                      <font color=red>**</font> </td>
                                </tr>
                                <tr bgcolor="#ffffff">
                                  <td align="right">QQ：</td>
                                  <td><input name=oicq type=text class="wenbenkuang" id="oicq" size="12" maxlength="12">                                  </td>
                                </tr>
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align=right>联系电话：</td>
                                  <td class=pad><input class="wenbenkuang" name="tel" maxlength="18" type="text" id="tel">
                                      <font color=red>**</font> </td>
                                </tr>
                               
                                <tr bgcolor="#FFFFFF">
                                  <td width=17% align="right"></td>
                                  <td class=pad><input class="go-wenbenkuang" onClick="return checkuserinfo();" type=submit name="submit" value=" 提交信息 ">
                                      <input class="go-wenbenkuang" onClick="ClearReset()" type=reset name="Clear" value=" 重新填写 ">                                  </td>
                                </tr>
                              </table>
                          </form></td>
                      </tr>
                  </table></td>
                </tr>
              </table>
              <br>
              <%case "save"%>
             
              <%call saveuser()%>
              <%
end select%>
            <%sub tiaoyue()
Response.Write("条约")
end sub
sub saveuser()
if session("regtimes")=1 then
response.Write "<table width=100% border=0 cellspacing=0 cellpadding=0 align=center><tr><td height=300 align=center><font color=red>对不起，您刚注册过用户，请稍后再进行注册!</font></td></tr></table>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [admin] where Email='"&trim(request("email"))&"' or User='"&trim(request("user"))&"'",conn,1,1
if rs.recordcount>0 then
call usererr()
rs.close
else
rs.close
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from [admin]",conn,1,3
rs.addnew
rs("user")=trim(request("user"))
rs("pass")=md5(trim(request("pass")))
rs("quesion")=trim(request("quesion"))
rs("answer")=md5(trim(request("answer")))
rs("name")=trim(request("name"))
rs("youbian")=trim(request("youbian"))
rs("oicq")=trim(request("oicq"))
rs("tel")=trim(request("tel"))
rs("adddate")=now()
rs("qx")=1
rs("sex")=1
rs("userlastip")=Request.ServerVariables("REMOTE_ADDR")

rs.update
rs.close
set rs=nothing
set rs=conn.execute("select top 1 * from [admin] order by id desc")
userid=rs(0)
response.cookies("user")=trim(request("user"))
session("regtimes")=1
session.Timeout=20
rs.close
set rs=nothing
response.Write "<table width=100% align=center border=0 cellspacing=0 cellpadding=0  bordercolor=#CCCCCC><tr><td bordercolor=#FFFFFF bgcolor=#FFFFFF align=center> "
response.Write "<table width=450 border=0 align=center cellpadding=0 cellspacing=0><tr><td height=260>"
response.Write "<p>· <font color=red>用户注册成功!</font></p><p>· 恭喜您注册成为我网站的正式用户，请记好您的用户名及密码!</p>"
response.Write "<p>· <a href=index.asp>返回首页</a></p></td></tr></table></td></tr></table>"
end if
end sub
sub usererr()
response.write "<table width=100% align=center border=0 cellspacing=0 cellpadding=0  bordercolor=#CCCCCC><tr><td bordercolor=#FFFFFF bgcolor=#FFFFFF align=center>"
response.write "<table width=450 border=0 align=center cellpadding=2 cellspacing=0><tr><td height=260>"
response.write "<p>· <font color=red>用户注册失败!</font></p><p>· 您输入的用户名或e-mail地址已存在，请返回重新输入!</p><p>· <a href=javascript:history.go(-1)>返回上一页</a></p> </td></tr></table></td></tr></table>"
end sub
%></TD>
        </TR>
      </TBODY>
    </TABLE>
</body>
</html>
