用密码保护页面 (II)
2000-08-22 10:52:05 来源:WEB开发网核心提示:英文原文 现在我们创建查询语句,可以验证在表单中输入的内容是否与数据库中的内容相一致,用密码保护页面 (II), <%@ Language=VBScript %><% Response.Buffer = True %><HTML><BODY><% session(&
英文原文
现在我们创建查询语句,可以验证在表单中输入的内容是否与数据库中的内容相一致。
<%@ Language=VBScript %>
<% Response.Buffer = True %>
<HTML>
<BODY>
<% session("allow") = True %>
<%
UserName = Request.Form("username")
PassWord = Request.Form("password")
'grab the form contents
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open "your connection string here"
SQL = "Select * From tblLogin"
Set RS = MyConn.Execute(SQL)
If UserName = RS("UserName") AND Password = RS("Password") Then
'if there is a match then show the page
%>
Put the contents of your page here.
<%
Else
Response.Redirect "http://www.yourdomain.com/login.asp"
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
End If
%>
'if there was no match then make the visitor try again to login.
</BODY>
</HTML>
把含上述代码的文件命名为login.asp
现在我们创建查询语句,可以验证在表单中输入的内容是否与数据库中的内容相一致。
<%@ Language=VBScript %>
<% Response.Buffer = True %>
<HTML>
<BODY>
<% session("allow") = True %>
<%
UserName = Request.Form("username")
PassWord = Request.Form("password")
'grab the form contents
Set MyConn=Server.CreateObject("ADODB.Connection")
MyConn.Open "your connection string here"
SQL = "Select * From tblLogin"
Set RS = MyConn.Execute(SQL)
If UserName = RS("UserName") AND Password = RS("Password") Then
'if there is a match then show the page
%>
Put the contents of your page here.
<%
Else
Response.Redirect "http://www.yourdomain.com/login.asp"
RS.Close
MyConn.Close
Set RS = Nothing
Set MyConn = Nothing
End If
%>
'if there was no match then make the visitor try again to login.
</BODY>
</HTML>
把含上述代码的文件命名为login.asp
- ››iis7 下 url重写后原本存在的html不能访问了未能执...
- ››页面后退并刷新的javascript
- ››iis将Session值存到数据库中继续运行方法
- ››IIS7 Request format is unrecognized.
- ››IIS Rewrite 配置
- ››IIS7错误:“由于扩展配置问题而无法提供您请求的...
- ››IIS7应用PHP Manager使用FastCGI快速部署
- ››IIS短文件和文件夹泄漏漏洞的分析
- ››IIS .net 网站打不开 http:404 出错
- ››IIS上asp.net网站无法访问(错误:服务器应用程序不...
- ››IIS+PHP配置图文详解
- ››IIS7 下日期显示格式的解决办法
赞助商链接