📄 reg.asp
字号:
<!-- #include file="conn.asp" -->
<!-- #include file="config.asp" -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=sitename%> 版本:<%=vs%></title>
<link href="css/index.css" rel="stylesheet" type="text/css">
<script language="javascript">
function regck()
{
strmsg=" "
n=1
if (document.form1.username.value=="")
{
strmsg="用户名不能为空"
n=0
}
if (document.form1.email.value=="")
{
strmsg=strmsg+",email不能为空"
n=0
}
if (document.form1.password.value=="")
{
strmsg=strmsg+",密码不能为空"
n=0
}
if (document.form1.addr.value=="")
{
strmsg=strmsg+",地址不能为空"
n=0
}
if (document.form1.email.value.indexOf("@")<2)
{
strmsg=strmsg+",email不正确"
n=0
}
if(n==1)
{
document.form1.submit();
return true;
}
if(n==0)
{
alert(strmsg+"!")
return true;
}
}
function ch(showone,showtwo,n)
{
//showone="showtxt"
//showtwo="showtxt0"
//n=1
var showtxt=document.getElementById(showone)
var showtxt0=document.getElementById(showtwo)
if (n==1)
{
showtxt.innerText=document.form1.username.value
showtxt0.innerText="用户名:"
if (document.form1.username.value=="")
{
showtxt0.innerText=""
}
}
if (n==2)
{
showtxt.innerText=document.form1.email.value
showtxt0.innerText="Email:"
if (document.form1.email.value=="")
{
showtxt0.innerText=""
}
}
if (n==3)
{
showtxt.innerText=document.form1.addr.value
showtxt0.innerText="地址 :"
if (document.form1.addr.value=="")
{
showtxt0.innerText=""
}
}
return true
}
</script>
</head>
<body>
<table width="50%" border="1" align="center" cellspacing="0" bordercolor="#99CCFF">
<tr>
<td align="center" bgcolor="#99CCFF">贴吧会员注册 </td>
</tr>
<tr>
<td>
<form name="form1" method="post" action="reg.asp?ac=1&burl=<%=request.servervariables("HTTP_REFERER")%>">
<table width="66%" border="0" align="center">
<tr>
<td width="17%">用户名:</td>
<td width="83%" ><input name="username" type="text" id="username" onKeyUp="ch('showtxt','showtxt0',1)" maxlength="15" >
</td>
</tr>
<tr>
<td>密码:</td>
<td><input name="password" type="password" maxlength="30" ></td>
</tr>
<tr>
<td>Email:</td>
<td><input name="email" type="text" onKeyUp="ch('showtxt11','showtxt10',2)" maxlength="40"></td>
</tr>
<tr>
<td>地址:</td>
<td><input name="addr" type="text" onKeyUp="ch('showtxt21','showtxt20',3)" maxlength="60"></td>
</tr>
<tr>
<td> </td>
<td><input type="button" name="Submit" value="注册" onClick="regck()">
<input type="reset" name="re" value="重置" ></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td bgcolor="#99CCFF"> </td>
</tr>
</table>
<table width="33%" border="0" align="center">
<tr>
<td align="right" id="showtxt0"> </td>
<td id="showtxt" > </td>
</tr>
<tr>
<td align="right" id="showtxt10"> </td>
<td id="showtxt11" > </td>
</tr>
<tr>
<td width="21%" align="right" id="showtxt20"> </td>
<td width="79%" id="showtxt21" > </td>
</tr>
</table>
<%
if request.QueryString("ac")=1 then
username=request.Form("username")
password=request.Form("password")
email=request.Form("email")
addr=request.Form("addr")
set rs=server.createobject("adodb.recordset")
sql="select * from users where username = '"& username &"'"
rs.open sql,conn,1,1
if rs.eof=false then
response.Write("<script language=javascript>alert('"&rs("username") & "已经被使用!"&"');")
response.Write("</script>")
rs.close
set rs=nothing
else
set rs=server.createobject("adodb.recordset")
sql="select * from users where id is null"
rs.open sql,conn,1,3
rs.addnew
rs("username")=username
rs("password")=password
rs("email")=email
rs("addr")=addr
rs("regtime")=now()
rs("ip")=request.ServerVariables("REMOTE_ADDR")
rs.update
rs.close
set rs=nothing
response.Write("<script language=javascript>alert('完成注册!');")
response.Write("window.location.href='"& request.QueryString("burl") &"';")
response.Write("</script>")
end if
end if
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -