📄 reg.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file=conn.asp-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>用户注册</title>
<style type="text/css">
<!--
.STYLE1 {font-size: xx-large}
-->
</style>
</head>
<body>
<%
dim action
action=trim(request.QueryString("action"))
if action="" then
call main()
else if action="reg" then
call reg()
end if
end if
sub main()
%>
<form action="?action=reg" method="post" name="form1" id="form1" onsubmit="checkform()">
<table width="478" height="217" border="0">
<tr>
<td colspan="2"><h5 align="center" class="STYLE1">用户注册</h5></td>
</tr>
<tr>
<td width="225" height="21"> 用户名: </td>
<td width="236"><input type="text" name="name" id="name" /></td>
</tr>
<tr>
<td height="24">密码:</td>
<td><input type="password" name="password" id="password" /> </td>
</tr>
<tr>
<td height="15"><p>确认密码:</p>
</td>
<td><input type="password" name="cpassword" id="cpassword" /></td>
</tr>
<tr>
<td>真实姓名</td>
<td><input type="text" name="realname" id="realname" /></td>
</tr>
<tr>
<td>
</td>
<td><input type="submit" name="submit" id="submit" value="提交" /></td>
</tr>
</table>
</form>
<script language=javascript>
function checkform()
{
if (document.form1.name.value==""){
alert("请输入用户名?")
document.form1.name.focus();
return false
}
if (document.form1.password.value==""){
alert("请输入密码?");
document.form1.password.focus();
return false
}
if (document.form1.cpassword.value==""){
alert("请输入密码?");
document.form1.cpassword.focus();
return false
}
if (document.form1.realname.value==""){
alert("请输入真实姓名?")
document.form1.realname.focus();
return false
}
if(document.form1.password.value!=document.form1.cpassword.value){
alert("密码不一致?");
reset_form();
document.form1.password.focus();
return false;
}
return true
}
function reset_form()
{
document.form1.password.value="";
document.form1.cpassword.value="";
}
</script>
<%
end sub
sub reg()
dim sql,name,password,cpassword,realname
name=trim(request.Form("name"))
password=trim(request.Form("password"))
realname=trim(request.Form("realname"))
set rs=server.CreateObject("adodb.recordset")
sql="select * from admins where susernames='"&name&"'"
rs.open sql,conn,1,3
if not rs.eof then
response.Write("<script language=Javascript>alert('该用户名已经被注册');")
response.Write("history.go(-1);")
response.Write("</script>")
response.End()
else
rs.addnew
rs("susernames")=name
rs("spasswords")=password
rs("realname")=realname
rs.update
response.Redirect("adm_login.asp")
rs.close
set rs=nothing
end if
end sub
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -