帮忙写后台ssesion(页面访问受限)!

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:28:40
最好详细点、有注释!QQ:84905209

登陆页面:
<!--#include file="conn.asp"-->
<%
dim user,password,sql
user=request.form("user")
password=request.form("password")
if user<>"" and password<>"" then
sql="select * from user where user='" &user& "'and pass_word='" &password& "'"
rs.open sql,conn,1,1
if not rs.eof then

response.Redirect "index0.asp"
else
%>
<script>
alert("您输入的用户名或密码不正确")
location.href="denglu.asp"
</script>
<%end if
else
%>
……登陆页面……
<%end if%>

相关受限页面:(应该在里面加什么?)

先谢谢了!如果有别的更好方法,也请详细说一下,谢谢!

在if not rs.eof then 后面加
session("admin")="admin" 值随便定义

在受限页面加语句
if session("admin") <> "admin" then response.Redirect("index.asp")
,如果没有登陆 则转到index.asp