在上面的程序中用到一个检查用户和密码是否正确的程序check.asp://核对输入的用户和密码是否正确
<%
dim name,password
name=request.form("name")
password=request.form("password")
dim exec,conn,rs
exec="select *from check where(name='"&name&"' and password='"&password&"')"
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("admin.mdb")
set rs=server.createobject("adodb.recordset")
rs.open exec,conn
if not rs.eof then
rs.Close
conn.Close
session("checked")="yes"
session("check")="right"
response.Redirect "index.asp"
else
session("checked")="no"
session("check")="wrong"
response.Redirect "login.asp"
end if
%>
left.asp://管理导航
<%@language=vbscript%>
<%if not session("checked")="yes" then
response.Redirect "login.asp"
else
%>
<html>
<head>
<title>管理界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body text="#000000" topmargin="0" bgcolor="#ffffff" leftmargin="10">
<div align="center"><a href="index.asp" target="_parent"><br>
<br>
管理界面首页</a> <a href="exit.asp" target="_parent">退出</a><br>
<br>
</div>
</body>
</html>
<%end if%>
exit.asp://退出系统
<%@language=vbscript%>
<%
session("check")=""
session("checked")=""
response.redirect "login.asp"
%>
right.asp://具体管理的内容
<%@language=vbscript%>
<%if not session("checked")="yes" then
response.Redirect "login.asp"
else
%>
<html>
<title>管理界面</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#ffffff" text="#000000" topmargin="20" class="title">
这里是网页教学网的管理系统示例!请大家多研究使用!
</body>
</html>
<%end if%>
运行时首先运行index.asp程序,运行效果部分截图如下: