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

📄 reg.asp

📁 购物系统时尚版.强大的后台文章编辑器的功能
💻 ASP
字号:
<%
dim key,toppath,dbpath
toppath=""
dbpath=""
%>
<!--#include file="db_conn.asp" -->
<!--#include file="my_lib/my_request.asp"-->
<!--#include file="my_lib/md5.asp"-->
<%
action=my_request("action",0)
if action="save" then
call save()
end if
%>
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/main.css" rel="stylesheet" type="text/css">
<SCRIPT language="javascript">
<!--
function regsubmit()
{
 if (document.reg.username.value == "")        
  {        
    window.alert("用户名不能为空!");        
    document.reg.username.focus();        
    return (false);}  
  
        var filter=/^\s*[.A-Za-z0-9_-]{5,15}\s*$/;
        if (!filter.test(document.reg.username.value)) { 
                window.alert("用户名填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - .)长度不小于5个字符,不超过15个字符,注意不要使用空格。"); 
                document.reg.username.focus();
                document.reg.username.select();
                return (false); 
                }
 if (document.reg.password.value == "")        
  {        
    window.alert("密码不能为空!");        
    document.reg.password.focus();        
    return (false);}  
  
        var filter=/^\s*[.A-Za-z0-9_-]{5,15}\s*$/;
        if (!filter.test(document.reg.password.value)) { 
                window.alert("密码填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - .)长度不小于5个字符,不超过15个字符,注意不要使用空格。"); 
                document.reg.password.focus();
                document.reg.password.select();
                return (false); 
                }
  if (document.reg.password2.value=="")
  {window.alert('请填写确认密码!');
  document.reg.password2.focus();
  return false;}
  
  if(document.reg.password2.value!==document.reg.password.value)	
{
	  window.alert("两次密码输入不一致。")
	   return false;}
if (document.reg.email.value=="")
  {window.alert('请输入电子邮件地址');
  document.reg.email.focus();
  return false;}
if (!IsEmail(document.reg.email.value))
  {window.alert('您的电子邮箱地址填写有误!');
  document.reg.email.focus();
  return false;}	
  if (document.reg.question.value=="")
  {window.alert('请填写问题!');
  document.reg.question.focus();
  return false;}
  if (document.reg.question.value.length>50)
  {window.alert('您的问题太长,只允许50字以内');
  document.reg.question.focus();
  return false;}
if (document.reg.answer.value=="")
  {window.alert('请填写答案!');
  document.reg.answer.focus();
  return false;}
if (document.reg.answer.value.length>50)
  {window.alert('您的答案太长,只允许50字以内');
  document.reg.answer.focus();
  return false;}
 }
 
 function IsEmail(argValue)
{var emailStr=argValue.toLowerCase();
var checkTLD=1;
var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
var validChars="\[^\\s" + specialChars + "\]";
var quotedUser="(\"[^\"]*\")";
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
var atom=validChars + '+';
var word="(" + atom + "|" + quotedUser + ")";
var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
var emailPat=/^(.+)@(.+)$/;
var matchArray=emailStr.match(emailPat);
if (matchArray==null)
  {return false;}
var user=matchArray[1];
var domain=matchArray[2];
for (i=0; i<user.length; i++)
  {if (user.charCodeAt(i)>127)
    {return false;}
  }
for (i=0; i<domain.length; i++)
  {if (domain.charCodeAt(i)>127)
    {return false;}
  }
if (user.match(userPat)==null)
  {return false;}
var IPArray=domain.match(ipDomainPat);
if (IPArray!=null)
  {for (var i=1;i<=4;i++)
    {if (IPArray[i]>255)
      {return false;}
    }
    return true;
  }
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++)
  {if (domArr[i].search(atomPat)==-1)
    {return false;}
  }
if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1)
  {return false;}
if (len<2)
  {return false;}
return true;
}
  //--></SCRIPT>
<title>用户注册</title>
</head>

<body topmargin="1">
<!--#include file="top.asp"-->

<div align="center">

	<table border="0" width="760" id="table1" cellpadding="0" bordercolor="#F47E36" cellspacing="0">
		<tr>
			<td>
<div align="center">
<table border="0" width="471" id="table2" cellspacing="1" bgcolor="#F9F9F9">
<form action="reg.asp" method=post name=reg onsubmit="return regsubmit();">
	<tr>
		<td align=center width="467" colspan="2">用户简单注册</td>
	</tr>
	<tr>
		<td width="161" align="right" valign=top>用户名:</td>
		<td width="303"><input type="text" name="username" size="20"> <br>
		<font color="#a9a9a9">* 用户名填写不正确,请重新填写!可使用的字符为(A-Z a-z 0-9 _ - 
		.)长度不小于5个字符,不超过15个字符,注意不要使用空格。</font></td>
	</tr>
	<tr>
		<td width="161" align="right">密码:</td>
		<td width="303"><input type="password" name="password" size="21"> 
		<font color="#A9A9A9">*同上</font></td>
	</tr>
	<tr>
		<td width="161" align="right">确认密码:</td>
		<td width="303"><input type="password" name="password2" size="21"> 
		<font color="#A9A9A9">*同上</font></td>
	</tr>
	<tr>
		<td width="161" align="right" valign=top>电子邮件地址:</td>
		<td width="303"><input name="email" size="20"> 
		<font color="#A9A9A9">*请正确填写,我们将给您邮件通知,此为重要的联系方式。</font></td>
	</tr>
	<tr>
		<td width="161" align="right">找回密码的问题:</td>
		<td width="303"><input type="text" name="question" size="20"> 
		<font color="#A9A9A9">*50字以内</font></td>
	</tr>
	<tr>
		<td width="161" align="right">找回密码的答案:</td>
		<td width="303"><input type="text" name="answer" size="20"> 
		<input type="hidden" name="action" value="save">
		<font color="#A9A9A9">*50字以内</font></td>
	</tr>
	<tr>
		<td width="467" colspan="2" align=center>
		<input type="submit" value="确认注册" name="B1"></td>
	</tr></form>
</table>
			</div>
			</td>
		</tr>
	</table>
</div>
<!--#include file="end.asp" -->
</body>

</html>
<%
sub save()
username=my_request("username",0)
password=my_request("password",0)
password2=my_request("password2",0)
question=my_request("question",0)
answer=my_request("answer",0)
email=my_request("email",0)
if username="" or password="" or password2="" or (password<>password2) or question="" or answer="" or email="" then
Response.write "<script>alert(""对不起,您的注册信息有错误,请重新填写。"");location.href=""reg.asp"";</script>"
Response.end
else
password=md5(password,32)
answer=md5(answer,32)
sql="select txt_login_name,txt_login_pass,txt_question,txt_answer,txt_email,dat_regtime from user_info_list where txt_login_name='"&username&"'"
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,3
if not rs.eof then
Response.write "<script>alert(""对不起,此用户名已被占用。"");location.href=""reg.asp"";</script>"
Response.end
else
rs.addnew
rs(0)=username
rs(1)=password
rs(2)=question
rs(3)=answer
rs(4)=email
rs(5)=now()
rs.update
rs.close
set rs=nothing
response.redirect "regcom.asp?email="&email
end if
end if
end sub
%>

⌨️ 快捷键说明

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