ASP用户登录验证代码

时间:2008-05-15 12:49:00 

asp+access用户登录代码,loginnew.asp网面包含了登录框及验证用户的代码

an.mdb数据库名

fd表名

y_username用户名字段,y_password密码字段.

loginnew.asp网页

<%
dim username,password
 
 username=request.form("username")
 password=request.form("password")
 set rs=server.createobject("adodb.recordset") 
 conn = "DBQ=" + server.mappath("huiyuan.mdb") + ";DefaultDir=;
DRIVER={Microsoft Access Driver (*.mdb)};" 
 sql="select * from pUser213 where y_username='"&username&"'"
 rs.open sql,conn,1,1
 if rs.eof then
  response.write "<script>alert('登录失败');history.back();</script>"
  response.end
  else
    if rs("y_password")<>password then
      response.write "<script>alert('登录失败');history.back();</script>"
      response.end     
     end if      
     session("admin")=username
response.write"<script>alert('登录成功');location.href='index.asp'</script>"
  end if
%>
再来看html 代码.
login.htm页面
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>登录 - asp之家</title>
</head>
<body>
<p> </p>
<form name="form1" method="post" action="loginnew.asp">
  <table width="200" border="1" align="center" cellpadding="0" cellspacing="0">
    <tr> 
      <td colspan="2"><div align="center">登录</div></td>
    </tr>
    <tr> 
      <td width="57"><div align="center">用户名</div></td>
      <td width="137" valign="top"><input name="username" type="text" 
id="username" size="25"></td>
    </tr>
    <tr> 
      <td><div align="center">密码</div></td>
      <td valign="top"><input name="password" type="password" 
id="password" size="25"></td>
    </tr>
    <tr> 
      <td colspan="2"><div align="center"> 
          <input type="submit" name="Submit" value="提交">
        </div></td>
    </tr>
  </table>
</form>
</body>
</html>
标签:验证,登录,asp
0
投稿

猜你喜欢

  • python3 unicode列表转换为中文的实例

    2021-02-13 20:06:06
  • Python 按字典dict的键排序,并取出相应的键值放于list中的实例

    2022-01-26 16:48:46
  • python利用smtplib实现QQ邮箱发送邮件

    2023-07-15 18:47:12
  • Python爬虫UA伪装爬取的实例讲解

    2021-12-01 22:48:00
  • 简单了解为什么python函数后有多个括号

    2021-05-11 03:29:35
  • Python安装Graphviz超详细图文教程

    2022-11-13 05:50:26
  • python 利用opencv实现图像网络传输

    2023-05-27 12:52:16
  • SQL中的连接查询详解

    2024-01-25 08:06:40
  • SQL Transcation的一些总结分享

    2012-08-21 10:21:28
  • 让IE8支持eWebEditor在线编辑器

    2010-02-28 10:36:00
  • numpy的squeeze函数使用方法

    2022-04-15 10:02:07
  • appium+python adb常用命令分享

    2022-12-27 09:16:24
  • Python中多线程thread与threading的实现方法

    2021-08-24 08:34:38
  • Python爬取门户论坛评论浅谈Python未来发展方向

    2021-10-26 19:09:12
  • 详解Python的collections模块中的deque双端队列结构

    2021-08-15 19:35:57
  • python中字符串的操作方法大全

    2023-10-01 17:47:15
  • Python常用数据结构和公共方法技巧总结

    2021-10-18 06:02:01
  • 简单分析python的类变量、实例变量

    2022-12-20 20:39:56
  • vue项目中使用Svg的方法

    2024-05-10 14:14:17
  • python中数组和矩阵乘法及使用总结(推荐)

    2021-11-30 04:29:31
  • asp之家 网络编程 m.aspxhome.com