日期:2014-05-17  浏览次数:21071 次

后台登入获取数据库地址不对,很奇怪,求解答
先看下报错:
错误类型:
Microsoft JET Database Engine (0x80004005)
找不到文件 'D:\★web_成品★\cms\admin\data.mdb'。
D:\★WEB_成品★\CMS\ADMIN\../Data/conn.asp, 第 5 行
=============================================================================================================
自己的解决法子:修改conn中的数据库地址为../Data/data.mdb(数据库和conn在一个文件夹下,这样的地址应该是不对的)
=============================================================================================================
看下目录结构

HTML code
<!--#include file="../include/function.asp"-->
<%
    '当有账号在线,要求重新登入
    response.charset = "GBK"
    if session("Admin") <> "" then
        call errorHistoryBack("必须退出当前帐号再登陆")
    end if
    '接收登录信息
    if request.form("submit") = "登录" then
        dim adminname,adminpass,yzm
        adminname = request.form("admin_name")
        adminpass = request.form("admin_pass")
        yzm = request.form("yzm")
        
        if len(adminname) <2 then
            call errorHistoryBack("用户名不得少于2位")
        end if 
        
        if len(adminpass) < 6 then
            call errorHistoryBack("密码不得少于6位")
        end if
        
        if len(yzm) <> 4 then
            call errorHistoryBack("验证码必须是4位",1)
        end if
        
        if not isnumeric(yzm) then
            call errorHistoryBack("验证码必须是数字")
        end if
        
        '判断服务器中的验证码信息
        if cint(yzm) <> Session("GetCode") then
            call errorHistoryBack("验证码错误")
        end if
        
        '判断数据库里的字段是否正确
%>
        <!--#include file="../Data/conn.asp"-->
        <!--#include file="../CheckCode/md5.asp"-->
<%
        dim rs,sql
        set rs = server.createobject("adodb.recordset")
        sql = "select * from Admin where AdminName='"&adminname&"' and AdminPass='"&md5(adminpass)&"'"
        rs.open sql,conn,1,1
        
        if not rs.eof then
            '数据正确
            session("Admin") = adminname
            response.redirect "admin_index.asp"
        else
            '数据不正确
            call close_rs
            call close_conn
            call errorHistoryBack("用户名或密码不正确")
        end if
        
        call close_rs
        call close_conn
    end if
%>
<!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-Type" content="text/html; charset=gb2312" />
<title>登入页-login</title>
<link href="css/login.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/login2.js"></script>
</head>

<body>
<div id="login-box">
   <div class="login-top">管理登入</div>
   <div class="login-main">
        <form  name="login" action="admin_login.asp" method="POST" id="login">
          <p><label for="admin_name">用户名</label>
               <input name="admin_name" type="text" id="admin_name" class="text">
          </p>
          <p><label for="admin_pass">密&nbsp;&nbsp;码</label>
               <input name="admin_pass" type="password" id="admin_pass" class="text">
          </p>
          <p><label for="yzm&quo