registercheck.asp

来自「包含注册、登陆、留言、创建主题等功能」· ASP 代码 · 共 55 行

ASP
55
字号
<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include file=04406shujuku.asp-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>注册检查</title>
</head>
<body>
<script language="vbScript" runat=Server>
function contain_invalid(x)
 contain_invalid=0
   for k=1 to len(x)
    ch=mid(x,k,1)
    m=asc(ch)
    if m<=32 and m>0 then
	  contain_invalid=1
	end if
	next
  end function
</script>

<%if trim(Request("no"))="" then  '防止黑客
response.write"<script>alert('请输入登录名');history.go(-1);</script>"
response.end
end if

if contain_invalid(Request.Form("no"))=1 then
response.write"<script>alert('登录名不能为非法字符');history.go(-1);</script>"
response.end
end if

if request.Form("pass1")<>request.Form("pass2") then
response.write"<script>alert('两次输入的密码不一致');history.go(-1);</script>"
response.end
end if

Dim sql
'标记是否找到以此为用户id的
sql="select* from user where userid='"&Request("no")&"'"
set rs=Conn.execute(sql)
if rs.eof then
   flag=0
else 
   flag=1'有用户注册
end if
rs.close
if flag=1 then
   response.redirect"registerfailure.asp"
else
   sql="insert into user values('"&request("no")&"','"&request("truename")&"','"&request("pass1")&"','"&request("email")&"',0)"
   Conn.execute(sql)
   response.redirect"registersuccess.asp"
end if%>
</body>
</html>

⌨️ 快捷键说明

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