chkuser.asp

来自「创建和运行动态、交互的Web服务器应用程序」· ASP 代码 · 共 36 行

ASP
36
字号
<!--#include file="conn.asp"-->
<%
dim username,userpassword,comeurl  //定义变量
    username    =trim(request("username"))  //获取用户名
    userpassword=trim(request("userpassword"))  //获取密码

if trim(request("comeurl"))="" then
   comeurl="index.asp"
else
   comeurl=trim(request("comeurl"))
end if

if username="" or userpassword="" then
   response.Write "<center><a href=login.asp><font color=red size=2>对不起,登陆失败,请检查您的登陆名和密码</font></a></center>"
   response.end
end if

set rs=server.CreateObject("adodb.recordset")
    rs.Open "select * from shop_user where username='"&username&"' and userpassword='"&userpassword&"' " ,conn,1,3
    if not(rs.bof and rs.eof) then
       if userpassword=rs("userpassword") then
          response.Cookies("bookshop")("username")=trim(request("username"))
          rs("lastlogin")=now()
          rs("logins")=rs("logins")+1
          rs.Update
          rs.Close
          set rs=nothing
          response.Write "<meta http-equiv=refresh content=0;URL="&comeurl&">"
       else
          response.write "<script LANGUAGE='javascript'>alert('对不起,您的用户名或密码有误!');window.location.reload('javascript:history.go(-1)')</script>"
       end if
   else
      response.write "<script LANGUAGE='javascript'>alert('对不起,您的用户名或密码有误!');window.location.reload('javascript:history.go(-1)')</script>"
   end if
%>

⌨️ 快捷键说明

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