快精灵印艺坊 您身边的文印专家
广州名片 深圳名片 会员卡 贵宾卡 印刷 设计教程
产品展示 在线订购 会员中心 产品模板 设计指南 在线编辑
 首页 名片设计   CorelDRAW   Illustrator   AuotoCAD   Painter   其他软件   Photoshop   Fireworks   Flash  

 » 彩色名片
 » PVC卡
 » 彩色磁性卡
 » 彩页/画册
 » 个性印务
 » 彩色不干胶
 » 明信片
   » 明信片
   » 彩色书签
   » 门挂
 » 其他产品与服务
   » 创业锦囊
   » 办公用品
     » 信封、信纸
     » 便签纸、斜面纸砖
     » 无碳复印纸
   » 海报
   » 大篇幅印刷
     » KT板
     » 海报
     » 横幅

用密码保护页面 (II)

英文原文


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

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


返回类别: 教程
上一教程: ASP分页显示Recordset数据
下一教程: 一个功能完善的专栏治理的程序->这是asp.net的第二个应用(三)

您可以阅读与"用密码保护页面 (II)"相关的教程:
· 用密码保护页面 (III)
· 用密码保护页面
· 用密码保护页面 (I)
· 输入准确进入密码保护页
· 保护你的ASP页面的两种办法
    微笑服务 优质保证 索取样品