来源:自学PHP网 时间:2015-02-03 17:41 作者: 阅读:次
[导读] 如何更好地保护我的网页?...
NEWSZW_HZH_BEGIN-->
main.htm <html> <body> <form action="login.asp" method="Post"> <input type="text" name="username" size="20"> 账号<br> <input type="password" name="password" size="20"> 密码<br> <input type="submit" value="进入"> </form> </body></html> login.asp <%@Language=VBScript%> <%Response.Buffer = True%> <html> <body> <% 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 %> </body></html> 做好了上面两个程序,再完善一下外围:把global.asa中的Session_Onstart加上 Session("allow") = False 语句,再在要保护的网页中加入下面的语句: <% @Language=VBScript %> <% Response.Buffer = True %> <% If session("allow") = False Then Response.Redirect "main.asp" %> [1] NEWSZW_HZH_END--> |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com