您现在的位置: ASP技术网 >> ASP学习 >> ASP安全加密 >> 文章正文

  没有公告

推荐文章
固顶文章在ASP中使用SQL语句之12:连接
推荐文章二级域名原理以及程序,申请即可
固顶文章十天学会ASP之第四天
固顶文章十天学会ASP之第三天
固顶文章十天学会ASP之第二天
热门文章
在ASP中使用SQL
十天学会ASP之第
十天学会ASP之第
十天学会ASP之第
专题栏目
用密码保护页面(2)
作者:本网收集 文章来源:本站原创 点击数: 更新时间:2004-9-18
(蜘蛛精 译)

英文原文


现在我们创建查询语句,可以验证在表单中输入的内容是否与数据库中的内容相一致。

<%@ 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
发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) 去论坛聊聊
    站内文章搜索
    点击申请点击申请点击申请点击申请点击申请点击申请点击申请点击申请