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

📄 reg.asp

📁 树形论坛
💻 ASP
字号:
<!-- #include file="function.asp" -->
<!-- #include file="MD5.asp" -->
<%
myfilename="reg.asp"

if adduseryn = 1 then error("本论坛暂时不开放新用户注册!")
if action="adduser" and Request.ServerVariables("request_method") = "POST" then
if Request.Cookies("regusertime")<>empty then
if DateDiff("s",Request.Cookies("regusertime"),Now()) < RegTime then error("论坛限制两次注册时间间隔"&RegTime&"秒!")
end if
username=HTMLEncode(Trim(Request.Form("username")))
errorchar=array(" "," ","	","#","`","|","%","&","","+",";")
for i=0 to ubound(errorchar)
if instr(username,errorchar(i))>0 then error("用户名中不能含有特殊符号")
next

userpass=Trim(Request.Form("userpass"))
userrpass=Trim(Request.Form("userrpass"))
usermail=HTMLEncode(Request.Form("usermail"))
userface=HTMLEncode(Request.Form("userhead"))
numcode=HTMLEncode(Request.Form("numcode"))
if username="" then  error("您的用户名没有填写")
if Len(username)<3 then error("您的用户名中不能少于3字节")
if Len(username)>15 then error("您的用户名中不能超过15字节")
set rs=server.createobject("ADODB.Recordset")
If not conn.Execute("Select id From [user] where username='"&username&"'" ).eof Then error("您填写的用户已有人注册了")
if userpass=empty then error("您没有填写密码")
if Len(userpass)<6 then error("您的密码不能少于6字节")
if userpass<>userrpass then error("您两次输入的密码不相同")
if usermail=empty then  error("您的电子邮件地址没有填写")
if instr(usermail,"@")=0 then error("您的电子邮件地址填写错误")
if instr(userface,";")>0 then error("您的头像选择有错")
if not isnumeric(numcode) and numcode<>"" then error("请您填写表单右边的验证码数字")
numcode=right(numcode,4)
if not ISNumeric(numcode) then numcode=1
if ccur(numcode)<>ccur(Session("numcode")) then error("你输入的验证码有错 ")

rs.Open "[user]",conn,1,3
rs.addnew
rs("username")=username
rs("userpass")=md5(userpass)
rs("usermail")=usermail
rs("userface")=userface
rs("userip")=remoteaddr
rs.update
rs.close
Set rs=Nothing

Response.Cookies("username")=username
Response.Cookies("userpass")=md5(userpass)
Response.Cookies("regusertime")=Now()
message="<li>用户注册成功<li><a href=./>返回论坛首页</a>"
succeed(""&message&"<meta http-equiv=refresh content=2;url=./>")







Response.End
end if'''''''''''
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=forumname%>用户注册</title>

<style>
<!--
BODY{font-size:12px;}
td        { font-size: 12px}
-->
</style>
</head>
<body topmargin="50">
<!--
'┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓'
'┃                   DATALL 知识库asp版 v2.0                              ┃'
'┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫'
'┃                   homepage:http://www.datall.com                       ┃'
'┃                            http://www.datall.net                       ┃'
'┃                   Q Q  NO.:194088                                      ┃'
'┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫'
'┃                          DATALL出品                                    ┃'
'┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛'
-->
<form name="form"  onsubmit="return VerifyInput();" action="<%=myfilename%>" method="post">
<input type=hidden name="action" value="adduser">
  <table cellSpacing="0" cellPadding="0" width="500" align="center" border="0">
    <tr>
      <td colSpan="3" height="29" style="font-size: 9pt">
      <table cellSpacing="0" cellPadding="0" width="100%" border="0">
        <tr>
          <td width="7" style="font-size: 9pt">
          <img alt src="images/topbg_01.gif" width="7" height="29"></td>
            <td background="images/topbg_02.gif" style="font-size: 9pt"> <table cellSpacing="0" cellPadding="0" width="100%" border="0">
                <tr> 
                  <td width="3%"></td>
                  <td vAlign="center" align="left" width="85%"> <font color="#ffffff"><b><%=forumname%>用户注册</b></font></td>
                  <td align="right" width="12%"> &nbsp;&nbsp;</td>
                </tr>
              </table></td>
          <td width="8" style="font-size: 9pt">
          <img alt src="images/topbg_03.gif" width="8" height="29"></td>
        </tr>
      </table>
      </td>
    </tr>
    <tr>
      <td width="3" background="images/link.gif" style="font-size: 9pt"></td>
      <td vAlign="top" style="font-size: 9pt">
      <table cellSpacing="0" cellPadding="0" width="100%" border="0">
        <tr>
          <td style="font-size: 9pt">
          <table width="100%" align="center" bgColor="#eeead6" border="0">
            <tr>
              <td vAlign="top" style="font-size: 9pt"><fieldset>
              <legend accessKey="F" align="left">用户注册</legend>
			  <table width="95%" align="center" border="0" cellspacing="0" cellpadding="0"height="130">
                      <tr> 
                      <td width="24%" height="10" valign="top">&nbsp;</td>
                      <td width="76%" valign="top">&nbsp;</td>
                    </tr>
					<tr>
                      <td height="20" align="right">用户名:</td>
                      <td>&nbsp; 
                        <input name="username" type="text" size="20" maxlength="12">
                        <font color="#FF0000">*</font> &nbsp;(12字节)</td> 
                    </tr> 
					<tr>
                      <td height="20" align="right">密码:</td>
                      <td>&nbsp; 
                        <input name="userpass" type="password" size="20" maxlength="20">
                        <font color="#FF0000">*</font> &nbsp;(6-20字节)</td>	 
                    </tr> 
					<tr>
                      <td height="20" align="right">确认密码:</td>
                      <td>&nbsp; 
                        <input name="userrpass" type="password" size="20" maxlength="20">
                        <font color="#FF0000">*</font> &nbsp;(6-20字节)</td> 
                    </tr> 
					<tr>
                      <td height="20" align="right">电子邮箱:</td>
                      <td>&nbsp; 
                        <input name="usermail" type="text" size="30" maxlength="50"> <font color="#FF0000">*</font></td> 
                    </tr> 
					<tr>
                      <td height="20" align="right" valign="top"><img src="images/face/1.gif" name="tus" ></td>
                      <td valign="top">&nbsp;<script>function showimage(){document.images.tus.src="images/face/"+document.form.userhead.options[document.form.userhead.selectedIndex].value+".gif";}</script>
选择头像:<select name=userhead size=1 onChange="showimage()"> 
<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option><option value="24">24</option></select>
<br>
<br>
&nbsp;输入右边的验证码: 
<input name="numcode" type="text" size="6">&nbsp;&nbsp;<img src="validate.asp"></td>
                    </tr> 
                    <tr> 
                      <td height="20" colspan="2" align="center" ><input type=submit name=button value=' 注 册 '> 
                      </td>
                    </tr>
                    <tr> 
                      <td height="2" colspan="2"> </td>
                    </tr>
                    
                  </table>
                  </fieldset></td>
            </tr>
          </table>
          </td>
        </tr>
      </table>
      </td>
      <td width="3" background="images/link.gif" style="font-size: 9pt"></td>
    </tr>
    <tr>
      <td background="images/linkbom.gif" colSpan="3" height="3" style="font-size: 9pt"></td>
    </tr>
  </table>
  </form>

  </body>
</html>
<SCRIPT>
function VerifyInput()
{
username=document.form.username.value

if (username == "")
{
alert("请输入您的用户名");
document.form.username.focus();
return false;
}

if (document.form.usermail.value == "")
{
alert("请输入您的EMAIL地址");
document.form.usermail.focus();
return false;
}

var mail = document.form.usermail.value;
if(mail.indexOf('@',0) == -1 || mail.indexOf('.',0) == -1){
alert("您输入的Email有错误\n请重新检查您的Email");
document.form.usermail.focus();
return false;
}
return true;
}
</SCRIPT>

⌨️ 快捷键说明

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