asp简单的转向

目录

通过3.asp来登陆,然后利用check.asp来检查,保存公用变量,分别转向管理员和普通用户

3.asp

<%language="vbscript"%>
<html>
<head>
<title>登陆验证</title>
</head>
<body>
<p align="center" ><font color=red>登陆验证</font></p>
<form name="bd" method="post" action="check.asp">
<table width="100%" border="0" cellpadding="0" cellspacing="">
<tr><td width="50%" align="right" valign="middle" height="37"><font color=red>*</font>用户名:</td>
<td width="50%" align="left" valign="middle" height="37"><input type="text" name="yh" size="17"></td></tr>
<tr><td width="50%" align="right" valign="middle" ><font color=red>*</font>密码:</td>
<td width="50%" align="left" valign="middle"><input type="password" name="mm" size="18"></td></tr>
<tr><td align="right"><input type="submit" name="tj" value="提交"></td>
<td align="left"><input type="Reset" name="qx" value="取消"></td></tr>
</table>
</form>
</body>
</html>

check.asp

<%language="vbscript"%>
<%response.buffer=true%>
<html>
<head>
</head>
<title>登陆验证</title>
<body>
<% session("user")=request.form("yh")
   session("password")=request.form("mm")
if session("user")="admin" and session("password")="admin" then
Response.clear
Response.Redirect "admin.asp"
else
Response.Redirect "user.asp"
end if
%>
</body>
</html>

admin.asp

<%language="vbscript"%>
<html>
<head>
</head>
<title>登陆验证</title>
<body>
<%
Response.Write "欢迎管理员:"&session("user")&"你是管理员用户,可以进行添加,删除,修改,查询操作!"&"<br>"
%>
</body>
</html>

user.asp

<%language="vbscript"%>
<html>
<head>
</head>
<title>登陆验证</title>
<body>
<%
Response.Write "欢迎用户:"&session("user")&"你是一般用户,可以查询,修改自己信息的操作!"&"<br>"
%>
</body>
</html>