ASP用户登录代码

asp+access用户登录代码,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>登录</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>

时间: 2024-07-31 01:48:12

ASP用户登录代码的相关文章

asp 用户登录代码

文章提供一款简单的asp 用户登录代码,提供了从数据库教程连接到文件的登录以及用户在输入信息时js判断验证哈. <% 'dim databasename,conn,constr databasename="userman.mdb" constr="provider=microsoft.jet.oledb.4.0;data source=" & server.mappath(databasename) set conn=server.createobje

asp用户登录模块实例代码

 asp用户登录模块实例代码: 用户登录验证脚本,Chkpwd.asp 以下为引用的内容: <%  '=======用户登录验证脚本=======  '如果尚未定义Passed对象,则将其定义为false,表示没有通过验证  If IsEmpty(Session("Passed")) Then  Session("Passed")=false  End If  'Session("Passed")=False,表示尚未通过验证,则开始读取从

ASP用户登录模块的设计

ASP用户登录模块的设计 用户登录验证脚本,Chkpwd.asp <% '=======用户登录验证脚本======= '如果尚未定义Passed对象,则将其定义为false,表示没有通过验证 If IsEmpty(Session("Passed")) Then Session("Passed")=false End If   'Session("Passed")=False,表示尚未通过验证,则开始读取从表单传来的验证信息 If Sess

php用户登录代码

//方法一 window 验证用户登录      代码如下 复制代码      $admin_name="admin";         $admin_pawd="admin";         if($php_auth_user!=$admin_name||$php_auth_pw!=$admin_pawd)         {                 header('www-authenticate: basic realm="系统验证&quo

ASP.NET登录代码实现

问题描述 本人是初学者现在正在做Web版的高校科研管理系统中的科研项目子系统,急求登录代码在一个登录网页中,有用户名和密码两个文本框,有两个Button控件,一个是登录,一个是重置我的sqlserver2005数据库的数据表名称是DataBase,里面的字段是Username,Password跪求高手的详细登录代码万分感激!!!!这是拉完控件后的代码开发工具:vs2005+sql2005,开发语言:c#usingSystem;usingSystem.Data;usingSystem.Config

php用户登录代码session、cookie自动记忆功能

我们先来看个最简单的实例 以下附简单的login.htm内容  代码如下 复制代码 <html> <body> <form name="login" action="login.php" method=post> 用户名<input type=text name="name"> <p>密码<input type=password name="password"&

asp用户登录,退出登录函数

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-

二种php用户登录代码(cookie,数据库)

下面我们要讲到二种用户登录方法一种是利用window验证加数据库教程密码验证实现登录,后者是利用cookie记录用户信息进行登录,有需要的朋友可以试下. <?php教程    function authenticate_user() {       header('WWW-Authenticate: Basic realm="Secret Stash"');       header("HTTP/1.0 401 Unauthorized");       ex

[转]php用户登录代码

效果图. index.php教程  代码如下 复制代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <me