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

📄 reg.asp

📁 时代购物系统 4.0功能升级说明 <1>完善了3.0的VIP
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%dim action
action=request.QueryString("action")%>
<title><%=webname%>--新用户注册</title> 
<!--#include file="include/header.asp"--> 
<%
select case action
case ""%> 
<TABLE WIDTH="760" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0" bgcolor="#FFFFFF"> 
<TR> <TD HEIGHT="18" ALIGN="center"><br><B><FONT SIZE=2><%=webname%>注册条约</FONT></B></TD></TR> 
<TR> <TD align=center valign="top"> <%call tiaoyue()%> </TD></TR> 
<TR> <FORM NAME="form1" METHOD="post" ACTION="reg.asp?action=yes"> <TD ALIGN="center"> 
<INPUT TYPE="submit" NAME="Submit4"STYLE="height:20; font:9pt; BORDER-BOTTOM: #cccccc 1px groove; BORDER-RIGHT: #cccccc 1px groove; BACKGROUND-COLOR: #eeeeee" VALUE="我 同 意"> 
&nbsp;&nbsp; <INPUT TYPE="button" NAME="Submit22" VALUE="我 不 同 意" STYLE="height:20; font:9pt; BORDER-BOTTOM: #cccccc 1px groove; BORDER-RIGHT: #cccccc 1px groove; BACKGROUND-COLOR: #eeeeee"ONCLICK="location.href='../'"> 
</TD></FORM></TR> </TABLE>

<%case "yes"%>
<TABLE WIDTH="760" BORDER="0" ALIGN="center" CELLPADDING="0" CELLSPACING="0" bgcolor="#ffffff">
  <tr> 
    <TD colspan="2" ALIGN="center"><FONT COLOR="#cb6f00">请填写用户信息</FONT></TD>
  </tr>
  <FORM NAME="userinfo" METHOD="post" ACTION="reg.asp?action=save" >
    <TR> 
      <TD align="right"><FONT COLOR="#cb6f00">用 户 名:</FONT></TD>
      <TD width="550"><INPUT NAME="username" TYPE="text" ID="username2" >
        用户名长度不能小于2。</TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR="#cb6f00">密  码:</FONT></div></TD>
      <TD> <INPUT NAME="password" TYPE="password" ID="password">
        长度必须大于6个字符。</TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR="#cb6f00">确认密码:</FONT> </div></TD>
      <TD> <INPUT NAME="password1" TYPE="password" ID="password1"> </TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR="#cb6f00">电子信箱:</FONT> </div></TD>
      <TD> <INPUT NAME="useremail" TYPE="text" ID="useremail2">
        请您务必填写正确的E-mail地址,便于我们与您联系;</TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR="#cb6f00">真实姓名: </FONT></div></TD>
      <TD> <INPUT NAME="realname" TYPE="text" ID="realname2">
        收货人姓名。</TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR="#cb6f00">身 份 证: </FONT></div></TD>
      <TD> <INPUT NAME="identify" TYPE="text" ID="identify2" onkeypress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" 
		onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
        此项信息用于必要时以核实身份,一经注册,便不可更改,请如实填写!</TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR="#cb6f00">电话号码: </FONT></div></TD>
      <TD> <INPUT NAME="mobile" TYPE="text" ID="mobile2" onkeypress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" 
		onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
        请填写正确的号码,以便有急事联系。</TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR="#cb6f00"> 腾讯 Q Q:</FONT> </div></TD>
      <TD> <INPUT NAME="userqq" TYPE="text" ID="userqq2" onkeypress	= "return regInput(this,	/^\d*\.?\d{0,2}$/,		String.fromCharCode(event.keyCode))" 
		onpaste		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		window.clipboardData.getData('Text'))"
		ondrop		= "return regInput(this,	/^\d*\.?\d{0,2}$/,		event.dataTransfer.getData('Text'))">
        网上联系</TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR=#cb6f00>密码提示: </FONT></div></TD>
      <TD> <INPUT NAME="quesion" TYPE="text" ID="quesion2"> </TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR=#cb6f00>密码答案: </FONT></div></TD>
      <TD> <INPUT NAME="answer" TYPE="text" ID="answer2"> </TD>
    </TR>
    <TR> 
      <TD><div align="right"><FONT COLOR="#cb6f00">推 荐 人: </FONT></div></TD>
      <TD> <INPUT NAME="recommender" TYPE="text" ID="recommender"> </TD>
    </TR>
    <TR> 
      <TD></TD>
      <TD> <INPUT ONCLICK="return check();" TYPE="submit" NAME="Submit3" STYLE="height:20; font:9pt; BORDER-BOTTOM: #cccccc 1px groove; BORDER-RIGHT: #cccccc 1px groove; BACKGROUND-COLOR: #eeeeee"VALUE="提  交" >
        &nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="Submit5" STYLE="height:20; font:9pt; BORDER-BOTTOM: #cccccc 1px groove; BORDER-RIGHT: #cccccc 1px groove; BACKGROUND-COLOR: #eeeeee" value="清  除"> </TD>
    </TR>
	<tr><td height="5"></td></tr>
  </FORM>
</TABLE>

<%case "save"%> 
<!--#include file="func.asp"--> 
<%call saveuser()%> <%
end select%> 
<!--#include file="include/footer.asp"--> 
<%sub tiaoyue()
set rs=server.CreateObject("adodb.recordset")
rs.Open "select rule from config",conn,1,1
response.Write trim(rs("rule"))
rs.Close
set rs=nothing
end sub

sub saveuser()
dim rsrec,strgift,stradd,strresult
if session("regtimes")=1 then
response.Write "<div align=center><br><br>对不起,您刚注册过用户。<br>请稍后再进行注册!</font></div><br>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select username,useremail from [user] where username='"&trim(request.form("username"))&"' or useremail='"&trim(request.form("useremail"))&"'",conn,1,1
if not rs.eof and not rs.bof then
call usererr()
rs.close
set rs = nothing
else
rs.close


rs.open "select * from [user]",conn,1,3
rs.addnew
rs("username")=trim(request.form("username"))
rs("password")=md5(trim(request.form("password")))
rs("useremail")=trim(request.form("useremail"))
rs("quesion")=trim(request.form("quesion"))
rs("answer")=md5(trim(request.form("answer")))
rs("recommender")=stradd
rs("realname")=trim(request.form("realname"))
rs("identify")=trim(request.form("identify"))
rs("mobile")=trim(request.form("mobile"))
rs("userqq")=trim(request.form("userqq"))
rs("adddate")=now()
rs("lastvst")=now()
rs.update
rs.close
set rs=nothing
 %>
<table width=760 border=0 align=center cellpadding=0 cellspacing=1 bgcolor=<% = bgclr1 %>>
<tr><td height=100 bgcolor=<% = bgclr4 %>>
<table width=700 border=0 align=center cellpadding=0 cellspacing=0>
<tr><td height=80 bgcolor=<% = bgclr4 %>><font color=#FF0000>用户注册成功<br></font>
恭喜<% = request.Cookies("timesshop")("username") %>,您已注册成为[<% = webname %>]正式用户,请进行下一步操作:<br><br>
·<% = strresult %><br><br>
·<a href=profile.asp?action=receiveaddr>为了方便您的购物,建议您填写详细的收货人资料</a><br><br>
·<a href=index.asp>返回首页</a></td></tr></table>
</td></tr></table>
<%
end if
end sub

sub usererr() %>
<table width=760 height=80 border=0 align=center cellpadding=0 cellspacing=1 bgcolor=<% = bgclr1 %>>
<tr><td bgcolor=#FFFFFF>
<table width=700 border=0 align=center cellpadding=2 cellspacing=0>
<tr><td><font color=#FF0000>用户注册失败</font></td></tr>
<tr><td>
·您输入的用户名或Email地址已经被注册,请选用其他的用户名或者E-mail!<br>
·<a href=javascript:history.go(-1)><font color=red>点击返回上一页</font></a> 
</td></tr></table>
</td></tr></table>
<%
end sub
%> 
<SCRIPT LANGUAGE="JavaScript">
<!--
function check()
{
   if(checkspace(document.userinfo.username.value)) {
	document.userinfo.username.focus();
    alert("用户名不能为空,请重新输入!");
	return false;
  }
    if(checkspace(document.userinfo.username.value) || document.userinfo.username.value.length < 2) {
	document.userinfo.username.focus();
    alert("用户名长度不能小于2,请重新输入!");
	return false;
  }
    if(checkspace(document.userinfo.identify.value) || document.userinfo.identify.value.length < 15) {
	document.userinfo.identify.focus();
    alert("身份证号码长度不能小于15位,请重新输入!");
	return false;
  }
  if(checkspace(document.userinfo.identify.value) || document.userinfo.identify.value.length > 18) {
	document.userinfo.identify.focus();
    alert("身份证号码长度不能大于18位,请重新输入!");
	return false;
  }
    if(checkspace(document.userinfo.password.value) || document.userinfo.password.value.length < 6) {
	document.userinfo.password.focus();
    alert("密码长度不能小于6,请重新输入!");
	return false;
  }
    if(document.userinfo.password.value != document.userinfo.password1.value) {
	document.userinfo.password.focus();
	document.userinfo.password.value = '';
	document.userinfo.password1.value = '';
    alert("两次输入的密码不同,请重新输入!");
	return false;
  }

 if(document.userinfo.useremail.value.length!=0)
  {
    if (document.userinfo.useremail.value.charAt(0)=="." ||        
         document.userinfo.useremail.value.charAt(0)=="@"||       
         document.userinfo.useremail.value.indexOf('@', 0) == -1 || 
         document.userinfo.useremail.value.indexOf('.', 0) == -1 || 
         document.userinfo.useremail.value.lastIndexOf("@")==document.userinfo.useremail.value.length-1 || 
         document.userinfo.useremail.value.lastIndexOf(".")==document.userinfo.useremail.value.length-1)
     {
      alert("Email地址格式不正确!");
      document.userinfo.useremail.focus();
      return false;
      }
   }
 else
  {
   alert("Email不能为空!");
   document.userinfo.useremail.focus();
   return false;
   }

}

function regInput(obj, reg, inputStr)
	{
		var docSel	= document.selection.createRange()
		if (docSel.parentElement().tagName != "INPUT")	return false
		oSel = docSel.duplicate()
		oSel.text = ""
		var srcRange	= obj.createTextRange()
		oSel.setEndPoint("StartToStart", srcRange)
		var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
		return reg.test(str)
	}


function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//-->
</script>

⌨️ 快捷键说明

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