📄 logon.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>登录界面</title>
</head>
<!--#include file="connection.asp"-->
<body><form id="form1" name="form1" method="post" action="logon.asp?action=Chklogon">
<table width="300" border="1" align="center">
<tr>
<td>
<label>账号
<input type="text" name="account" />
</label> </td>
</tr>
<tr>
<td>
<label>密码
<input type="password" name="password" />
</label> </td>
</tr>
<tr>
<td>
<label>
<input type="radio" name="logon_type" value="0" />
管理员</label>
<label>
<input type="radio" name="logon_type" value="1" />
员工</label>
<label>
<input type="submit" name="Submit" value="登录" />
</label>
</td>
</tr>
</table>
</form>
<p> </p>
<%
If Request("action")="Chklogon" Then
Call Chklogon()
End If
%>
<%
Sub Chklogon()
account=trim(Request("account"))
password=trim(Request("password"))
logon_type=Request("logon_type")
if account="" or password="" then
Response.Write "<script>alert('请输入账号或密码!');history.go(-1);</script>"
Response.End
end if
Set rs=Server.CreateObject("ADODB.Recordset")
if logon_type=0 then
strsql="Select * From [admin] Where account='"&account&"'"&"And password='"&password&"'"
rs.Open strsql,con,3,3
if rs.eof or rs.bof then
Response.Write "<script>alert('账号或密码错误!');history.go(-1);</script>"
Response.End
else
Session("admin")=rs("account")
Session("password")=rs("password")
Response.Redirect"admin.asp"
end if
else
strsql="Select * From [employee] Where account='"&account&"'"&"And password='"&password&"'"
rs.Open strsql,con,3,3
if rs.eof or rs.bof then
Response.Write "<script>alert('账号或密码错误!');history.go(-1);</script>"
Response.End
else
Session("account")=rs("account")
Session("name")=rs("name")
Session("employeeid")=rs("keyid")
Response.Redirect"staff.asp"
end if
end if
End Sub
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -