chkuser.asp

来自「基于IIS+ASP的」· ASP 代码 · 共 37 行

ASP
37
字号
<!--#include file="conn.asp"-->
<!--#include file="error.asp"-->

<%
'johnson code
    LoginName=request("LoginName")
    PassWord=request("PassWord")
    if LoginName="" or PassWord="" then
      showerr "用户名和密码必须填写!","index.asp" 
	  response.End()
	else
	  if InStr(LoginName,"'") > 0 or InStr(Password,"'") > 0 then
	     showerr "用户名或密码中包含非法字符!","index.asp" 
	     response.End()
	  else
	  sql="select * from user where user='"&LoginName&"' and pwd='"&PassWord&"' and op=3"
	  set rs=conn.execute(sql)
	     if not rs.eof then 
		    rs.close 
			set rs=nothing 
	        set conn=nothing 
	        session("user")=LoginName
	        session("pwd")=PassWord 
	        response.Redirect("main.asp")
			response.End()
	     else
		    rs.close
			set rs=nothing
	        set conn=nothing
	        showerr "用户名或密码错误!","index.asp" 
	        response.End()
	     end if
     end if
     
    end if
%>

⌨️ 快捷键说明

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