hogsmeade:哪位知道是什么意思的

来源:百度文库 编辑:高校问答 时间:2024/04/29 16:57:32
Session(\"allow\") = True
是在登陆是做判断用的
manage.asp' 登录页面
<%@ Language=VBScript %><HTML><BODY><form name="Login" method="Post" action="login.asp"><input type="text" name="username" size="20">用户名<br><input type="password" name="password" size="20">口令<br><input type="submit" name="btnLogin" value="登录"></form></BODY></HTML>login.asp' 验证在表单中输入的用户名和口令
<%@ Language=VBScript %><% Response.Buffer = True %><HTML><BODY><% Session("allow") = True %><%UserName = Request.Form("username")Password = Request.Form("password")' 抓取表单内容Set MyConn=Server.CreateObject("ADODB.Connection")MyConn.Open "连接字符串"SQL = "Select * From tblLogin"Set RS = MyConn.Execute(SQL)If UserName = RS("UserName") AND Password = RS("Password") Then' 如果匹配则显示要保护的页面%>----------------------------------------------------------------------------------------------------------------' 此处放置要保护的页面的内容----------------------------------------------------------------------------------------------------------------<%ElseResponse.Redirect "http://www.intels.net/login.asp"RS.CloseMyConn.CloseSet RS = NothingSet MyConn = NothingEnd If%>' 如果不匹配则返回登录页,让用户重新登录</BODY></HTML> 好了,让我们来做最后的应用工作吧,把下面的代码加入需要保护的页面的最前面:<%@ Language=VBScript %><% Response.Buffer = True %><% If session("allow") = False Then Response.Redirect "manage.asp" %>

Session(\"allow\") = True
是在登陆是做判断用的

manage.asp' 登录页面
<%@ Language=VBScript %>
<HTML>
<BODY>
<form name="Login" method="Post" action="login.asp">
<input type="text" name="username" size="20">用户名<br>
<input type="password" name="password" size="20">口令<br>
<input type="submit" name="btnLogin" value="录">
</form>
</BODY>
</HTML>

login.asp' 验证在表单中输入的用户名和口令
<%@ Language=VBScript %>
<% Response.Buffer = True %>
<HTML>
<BODY>
<% Session("allow") = True
UserName = Request.Form("username")
Password = Request.Form("password")
' 抓取manage.asp表单内容
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open "连接字符串"
SQL = "Select * From tblLogin"
Set RS = MyConn.Execute(SQL)
If UserName = RS("UserName") AND Password = RS("Password") Then
' 如果匹配则显示要保护的页面
'此处放置要保护的页面的内容
Else
RS.Close
MyConn.Close
Set RS = NothingSet MyConn = Nothing
Response.Redirect "http://www.intels.net/login.asp"
' 如果不匹配则返回登录页,让用户重新登录
End If%>
</BODY>
</HTML>

好了,让我们来做最后的应用工作吧,把下面的代码加入需要保护的页面的最前面:
<%@ Language=VBScript %>
<% Response.Buffer = True %>
<% If session("allow") = False Then
Response.Redirect "manage.asp"
end if%>
这回能看明白了吧

这样难的问题你给0分?够可以的。