📄 reg.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="webconfig.asp"-->
<html>
<head>
<title><%=webname%>--新用户注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>
.pad {
PADDING-LEFT: 150px
}
</style>
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!--#include file="webtop.asp"-->
<%dim action
action=request.QueryString("action")%>
<table width="10" height="7" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height=7></td>
</tr>
</table>
<%select case action
case ""%><table width="776" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D0E2FD">
<tr>
<td height="78" valign="top" bgcolor="#FFFFFF"><br> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="18" bgcolor="#EFF5FE"><div align="center"><b><font size=2><%=webname%>注册条约</font></b></div></td>
</tr>
<tr>
<td bgcolor="#EFF5FE"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td> <%call tiaoyue()%> </td>
</tr>
</table></td>
</tr>
</table>
<div align="center">
<table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr><form name="form1" method="post" action="reg.asp?action=yes">
<td height="36"><div align="center">
<input type="submit" name="Submit" value="我 同 意">
<input type="button" name="Submit2" value="我 不 同 意" onClick="location.href='../'">
</div></td></form>
</tr>
</table>
</div>
</td>
</tr>
</table><%case "yes"%>
<table width="776" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D0E2FD">
<tr>
<td height="230" bgcolor="#FFFFFF"><div align="center"><font color="#cb6f00">请填写用户信息</font>
</div>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="1" >
<form name="userinfo" method="post" action="reg.asp?action=save" >
<tr>
<td class=pad bgcolor="#EFF5FE"><font color="#cb6f00">E-Mail
:</font> <input name="useremail" type="text" id="useremail"> <br>
请填写您有效的邮件地址,以便于我们为您提供有效的服务。</td>
</tr>
<tr>
<td class=pad bgcolor="#EFF5FE"><font color="#cb6f00">用 户 名:</font>
<input name="username" type="text" id="username" > <br>
用于登录时使用,用户名长度不能小于4且使用英文字母。</td>
</tr>
<tr>
<td class=pad bgcolor="#EFF5FE"><font color="#cb6f00">真实姓名:
<input name="userzhenshiname" type="text" id="userzhenshiname">
<br>
</font>以便发货确认。 </td>
</tr>
<tr>
<td class=pad bgcolor="#EFF5FE"><font color="#cb6f00">密
码:
<input name="userpassword" type="password" id="userpassword">
<br>
</font>长度必须大于6个字符小于50个字符,只能为英语字、数字,例如:ckxp3000等。<font color="#cb6f00">
</font></td>
</tr>
<tr>
<td class=pad bgcolor="#EFF5FE"><font color="#cb6f00">确认密码:
<input name="userpassword1" type="password" id="userpassword1">
<br>
</font>请将输入的密码再次输入,以免设置密码出错。<font color="#cb6f00"> </font></td>
</tr>
<tr>
<td class=pad bgcolor="#EFF5FE"><FONT color=#cb6f00>密码提问:
<input name="quesion" type="text" id="quesion">
</FONT>(用于密码遗忘时使用)<FONT color=#cb6f00> </FONT></td>
</tr>
<tr>
<td class=pad bgcolor="#EFF5FE"><FONT color=#cb6f00>密码答案:
<input name="answer" type="text" id="answer">
</FONT>(密码遗忘时将验证此答案) </td>
</tr>
<tr>
<td bgcolor="#EFF5FE" class=pad> <input onClick="return check();" type="submit" name="Submit3" value="提 交" ></td>
</tr>
</form>
</table>
<table width="10" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="7"></td>
</tr>
</table></td>
</tr>
</table>
<%case "save"%>
<!--#include file="md5.asp"-->
<%call saveuser()%>
<%
end select%>
<!--#include file="service.asp"-->
<!--#include file="copyright.asp"-->
</body>
</html>
<%sub tiaoyue()
set rs=server.CreateObject("adodb.recordset")
rs.Open "select regtiaoyue from shop_config",conn,1,1
response.Write trim(rs("regtiaoyue"))
rs.Close
set rs=nothing
end sub
sub saveuser()
if session("regtimes")=1 then
response.Write "<div align=center><font color=red size=60>对不起,您刚注册过用户。<br>请稍后再进行注册!</font></div>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select username,useremail from [user] where username='"&trim(request("username"))&"' or useremail='"&trim(request("useremail"))&"'",conn,1,1
if not rs.eof and not rs.bof then
call usererr()
rs.close
else
rs.close
rs.open "select * from [user]",conn,1,3
rs.addnew
rs("username")=trim(request("username"))
rs("userpassword")=md5(trim(request("userpassword1")))
rs("useremail")=trim(request("useremail"))
rs("quesion")=trim(request("quesion"))
rs("answer")=md5(trim(request("answer")))
rs("userzhenshiname")=trim(request("userzhenshiname"))
rs("adddate")=now()
rs("lastlogin")=now()
rs("logins")=0
rs("youbian")=0
rs.update
rs.close
set rs=nothing
response.Cookies("bookshop")("username")=trim(request("username"))
response.Cookies("bookshop").expires=date+1
session("regtimes")=1
session.Timeout=1
response.Write "<table width=776 border=0 align=center cellpadding=0 cellspacing=1 bgcolor=#D0E2FD><tr><td height=100 bgcolor=#FFFFFF>"
response.Write "<table width=90% border=0 align=center cellpadding=0 cellspacing=0><tr><td height=80 bgcolor=#EFF5FE class=pad><font color=#cb6f00>用户注册成功</font><br>"
response.Write "恭喜"&request.Cookies("bookshop")("username")&",您已注册成为《"&webname&"》正式用户,请进行下一步操作:<br>"
response.Write "·<a href=myuser.asp?action=shouhuoxx>填写收货人详细资料</a><br>·<a href=index.asp>返回书店首页</a></td></tr></table></td></tr></table>"
end if
end sub
sub usererr()
response.write "<table width=776 height=80 border=0 align=center cellpadding=0 cellspacing=1 bgcolor=#D0E2FD><tr>"
response.write "<td bgcolor=#FFFFFF><table width=90% border=0 align=center cellpadding=2 cellspacing=0><tr><td class=pad bgcolor=#EFF5FE><font color=#cb6f00>用户注册失败</font></td></tr><tr>"
response.write "<td class=pad bgcolor=#EFF5FE ><font color=#FF0000>·您输入的用户名或Email地址已存在,请返回重新输入!<br>·<a href=javascript:history.go(-1)><font color=red>点击返回上一页</font></a> </font></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 < 4) {
document.userinfo.username.focus();
alert("用户名长度不能小于4,请重新输入!");
return false;
}
if(checkspace(document.userinfo.userpassword.value) || document.userinfo.userpassword.value.length < 6) {
document.userinfo.userpassword.focus();
alert("密码长度不能小于6,请重新输入!");
return false;
}
if(document.userinfo.userpassword.value != document.userinfo.userpassword1.value) {
document.userinfo.userpassword.focus();
document.userinfo.userpassword.value = '';
document.userinfo.userpassword1.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 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 + -