📄 reg.asp
字号:
<!--#include file="inc/config.asp" -->
<!--#include file="inc/conn.asp" -->
<!--#include file="inc/md5.asp" -->
<SCRIPT LANGUAGE="JavaScript">
<!--
function chkinfo(){
if(checkspace(document.reginfo.username.value))
{
document.reginfo.username.focus();
alert("对不起,请填写用户名!");
return false;
}
if(checkspace(document.reginfo.password.value) || document.reginfo.password.value.length<6 || document.reginfo.password.value.length>20){
document.reginfo.password.focus();
alert("密码长度不能为空,或不在6位到20位之间,请重新输入!");
return false;
}
if(document.reginfo.password.value!=document.reginfo.password2.value){
document.reginfo.password.focus();
document.reginfo.password.value='';
document.reginfo.password.value='';
alert("两次输入的密码不同,请重新输入!");
return false;
}
if(document.reginfo.email.value.length!=0)
{
if (document.reginfo.email.value.charAt(0)=="." ||
document.reginfo.email.value.charAt(0)=="@"||
document.reginfo.email.value.indexOf('@', 0) == -1 ||
document.reginfo.email.value.indexOf('.', 0) == -1 ||
document.reginfo.email.value.lastIndexOf("@")==document.reginfo.email.value.length-1 ||
document.reginfo.email.value.lastIndexOf(".")==document.reginfo.email.value.length-1)
{
alert("Email地址格式不正确!");
document.reginfo.email.focus();
return false;
}
}
else
{
alert("Email不能为空!");
document.reginfo.email.focus();
return false;
}
if(checkspace(document.reginfo.question.value)){
document.reginfo.quesion.focus();
alert("对不起,请填写密码提问!");
return false;
}
if(checkspace(document.reginfo.answer.value)){
document.reginfo.answer.focus();
alert("对不起,请填写密码提问的答案!");
return false;
}
}
function checkspace(checkstr) {
var str = '';
for(i = 0; i < checkstr.length; i++) {
str = str + ' ';
}
return (str == checkstr);
}
//-->
</SCRIPT>
<%
dim tit
tit="用户注册"
call web_nav()
call web_head()
%>
<table width="798" border="0" cellspacing="0" cellpadding="0" align=center>
<tr>
<td width="1" bgcolor="#a5a5a5"></td>
<td width="780">
<table width="770" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td colspan=2><IMG SRC="pic/yhzc.gif" WIDTH="770" HEIGHT="34" BORDER="0"></td>
</tr>
<%
dim action,rs,rs1
action=trim(request.querystring("action"))
if action="reg" then
call reg_save()
else
call reg_zc()
end if
sub reg_save()
set rs1=conn.execute("select * from userinfo where username='"&trim(request("username"))&"'")
if rs1.eof and rs1.bof then
rs1.close
set rs1=nothing
set rs=server.createobject("adodb.recordset")
rs.open "select * from userinfo",conn,1,3
rs.addnew
rs("username")=trim(request("username"))
rs("userpassword")=md5(trim(request("password")),16)
rs("useremail")=trim(request("email"))
rs("question")=trim(request("question"))
rs("answer")=md5(trim(request("answer")),16)
rs.update
rs.close
set rs=nothing
session("username")=trim(request("username"))
response.write"<tr><td height=25>用户注册成功</td></tr>"
response.write"<tr><td height=25><li>恭喜您已注册成为正式用户,请记好您的用户名及密码</td></tr>"
response.write"<tr><td height=25><li><a href='index.asp'>返回首页</a></td></tr>"
else
response.write"<script>alert('该用户名已经被别人注册了,请返回另选别的用户名注册!');"
response.write"history.go(-1);</script>"
end if
end sub
sub reg_zc()
%>
<form action="?action=reg" method=post name="reginfo">
<tr>
<td height="30" width="160"> </td>
<td height="30"> </td>
</tr>
<tr>
<td height="20" width="160"> </td>
<td height="20">用 户 名:
<input type="text" name="username" size="20"> *
</td>
</tr>
<tr>
<td height="28" width="160"> </td>
<td height="28">请填写您用来登录的用户名。</td>
</tr>
<tr>
<td height="18" width="160"> </td>
<td height="18">登陆密码:
<input type="password" name="password" size="20"> *
</td>
</tr>
<tr>
<td height="28" width="160"> </td>
<td height="28">长度必须大于6个字符小于20个字符,只能为英语字、数字,例如:snsn2003等。</td>
</tr>
<tr>
<td height="18" width="160"> </td>
<td height="18">确认密码:
<input type="password" name="password2" size="20"> *
</td>
</tr>
<tr>
<td height="28" width="160"> </td>
<td height="28">请将输入的密码再次输入,以免设置密码出错。</td>
</tr>
<tr>
<td height="18" width="160"> </td>
<td height="18">电子邮件:
<input type="text" name="email" size="20"> *
</td>
</tr>
<tr>
<td height="28" width="160"> </td>
<td height="28">请填写您有效的邮件地址,以便于我们为您提供有效的服务。</td>
</tr>
<tr>
<td height="28" width="160"> </td>
<td height="28">密码提问:
<input type="text" name="question" size="20">
*(用于密码遗忘时使用) </td>
</tr>
<tr>
<td height="28" width="160"> </td>
<td height="28">密码答案:
<input type="text" name="answer" size="20">
*(密码遗忘时将验证此答案)</td>
</tr>
<tr>
<td height="50" align="center" width="160"> </td>
<td height="50">
<input type="submit" name="Submit" value="提交注册信息" onclick="return chkinfo();">
<input type="reset" name="Submit2" value="重新填写">
<input type="button" name="Submit3" value="返回">
(带*为必填项)</td>
</tr></form>
<% end sub %>
</table>
</td>
<td width="17" background="pic/right_bg.gif"></td>
</tr>
</table>
<% call web_foot() %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -