checklogin.asp

来自「作业提交评分管理系统」· ASP 代码 · 共 48 行

ASP
48
字号
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="tcconn.asp" -->
<html>
<head>
<title>Management System</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="title" content="Management System" />
</head>
<%
dim username ,password
username=trim(Request.Form("username"))
password=trim(Request.Form("password"))
username = Replace(username, "'", "")
password = Replace(password,"'", "")
if username="" or password="" then
 	response.write "<script language=JavaScript>{window.alert('用户和密码不能为空!');window.location.href='index.asp';}</script>"
    response.end
end if
Dim sql,Rs
sql = "select top 1 * from [dbo_manager] where [name] = '" & username & "'and [password]='" & password & "'"
Set Rs = Server.CreateObject("ADODB.Recordset")
Rs.Open sql,conn,1,1

If Rs.Recordcount=0  Then
   response.write "<script language=JavaScript>{window.alert('用户和密码错误!');window.location.href='index.asp';}</script>"
    Response.End()
End If
 session("userid") = Rs("id")
 session("username") = Rs("name")
 session("password") = Rs("password")
 session("admin_logged_in")=true
 session("img1")=""
 session("img")=""

 Response.Redirect "layout.asp"
 rs.close

%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body>
</body>
</html>

⌨️ 快捷键说明

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