繁体中文
设为首页
加入收藏
当前位置:ASP技术首页 >> 安全加密 >> 用密码保护页面 (II)

用密码保护页面 (II)

2004-10-01 08:26:10  作者:  来源:互联网  浏览次数:35  文字大小:【】【】【
简介:(蜘蛛精 译) 英文原文 现在我们创建查询语句,可以验证在表单中输入的内容是否与数据库中的内容相一致。 <%@ Language=VBScript %> <% Response.Buffer = True %> <HTML> <BODY>...
关键字:密码保护 页面 II

(蜘蛛精 译)

英文原文

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

<%@ Language=VBScript %>

<% Response.Buffer = True %>

<% 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.

把含上述代码的文件命名为login.asp

责任编辑:admin
相关文章