使用PHP MySQL从管理员下载PDF无效

时间:2017-11-13 14:44:01

标签: php mysql prepared-statement admin require-once

我有一个管理员经理,我可以用EXCEL格式导出用户详细信息以及两个不同的pdf(所有这些都通过MySql连接)。

我已将管理网站移至不同的域,其中所有内容都相同,但签证,额外pdf,excel部分的信息现在是一个子文件夹。所以它不再是域名/ admin / event /文件夹,而是域名/ admin / REGISTRATION / event /文件夹唯一不起作用的东西是下载部分。以下代码是我认为麻烦开始的地方

  require_once(dirname(__FILE__).'/login_check.php');
require_once(dirname(__FILE__).'/../config.php');
require_once(dirname(__FILE__).'/../inc/funciones.php');
require_once(dirname(__FILE__).'/../connections/conexion.php');
require_once(dirname(__FILE__).'/../connections/conexion_event.php');

if($_GET['accion'] == "visa") {
    if(!empty($_GET['id'])) {
        $stmt = $db -> prepare("SELECT e.Id, e.folder FROM events e WHERE e.Id = ? LIMIT 1");
        $stmt -> execute(array($_SESSION['sid_event']));
        $event = $stmt->fetch(PDO::FETCH_OBJ);

        $id_user  = $_GET['id'];
        $download = true;
        require_once(dirname(__FILE__) . '/../../' . $event->folder . '/inc/visa_pdf.php');
    }
}

if($_GET['accion'] == "extra") {
    if(!empty($_GET['id'])) {
        $stmt = $db -> prepare("SELECT e.Id, e.folder FROM events e WHERE e.Id = ? LIMIT 1");
        $stmt -> execute(array($_SESSION['sid_event']));
        $event = $stmt->fetch(PDO::FETCH_OBJ);

        $id_user  = $_GET['id'];
        $id_extra = $_GET['id_extra'];
        $download = true;
        require_once(dirname(__FILE__) . '/../../' . $event->folder . '/inc/extra_pdf.php');
    }
}

if($_GET['accion'] == "excel") {
    $stmt = $db -> prepare("SELECT e.Id, e.folder FROM events e WHERE e.Id = ? LIMIT 1");
    $stmt -> execute(array($_SESSION['sid_event']));
    $event = $stmt->fetch(PDO::FETCH_OBJ);

    require_once(dirname(__FILE__) . '/../../' . $event->folder . '/vendor/autoload.php'); // dependency (compose)

    $stmt = $db_event -> prepare("SELECT u.*, c.name as country, c.mu FROM users u INNER JOIN countries c ON c.Id = u.id_country WHERE u.active = 1 ORDER BY u.Id ASC");
    $stmt -> execute();
    $users = $stmt->fetchAll(PDO::FETCH_OBJ);

现在要访问我尝试require_once(dirname(__FILE__) . '/../../registration' . $event->folder . '/vendor/autoload.php');的新子文件夹 和 require_once(dirname(__FILE__) . '/../../' . $event->folder . 'registration/vendor/autoload.php');

但我无法下载该文件。如果有人能指出我正确的方向,我将不胜感激。

0 个答案:

没有答案