您现在的位置是:网站首页> 编程资料编程资料
如何更好地保护我的网页?_编程10000问_
2023-05-25
196人已围观
简介 如何更好地保护我的网页?_编程10000问_
main.htm
账号
密码
进入">
login.asp
<%@Language=VBScript%>
<%Response.Buffer = True%>
<%
UserName = Request.Form("username")
Password = Request.Form("password")
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open "Provider={Microsoft Access Driver (*.mdb)};
DBQ=D:\suifengqiwu\databases\test.mdb"
SQL = "Select * From tblLogin"
Set RS = MyConn.Execute(SQL)
If UserName = RS("UserName") And Password = RS("Password") Then
Session("allow") = True
< !-----连接保护的页面------->
Else
Response.Redirect "main.asp"
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
End If
%>
做好了上面两个程序,再完善一下外围:把global.asa中的Session_Onstart加上Session("allow") = False 语句,再在要保护的网页中加入下面的语句:
<% @Language=VBScript %>
<% Response.Buffer = True %>
<% If session("allow") = False Then Response.Redirect "main.asp" %>
[1]
