<?php //Imports require_once 'includes/db/db_conn.php'; require_once 'includes/db/SELECT.php'; require_once 'includes/classes/Correspondent.php'; require_once 'includes/classes/Hiker.php'; if (!isset($_GET['_']) || !is_numeric($_GET['_'])) { header("Location: ./"); } $ADK_CORR_ID = intval($_GET['_']); $con = connect_db(); $ADK_CORRESPONDENT = new Correspondent(); $ADK_CORRESPONDENT->id = $ADK_CORR_ID; $ADK_CORRESPONDENT->get($con); if ($ADK_CORRESPONDENT->name == '') { header("Location: ./"); } $ADK_HIKERS = new Hikers(); $ADK_HIKERS->get($con, $ADK_CORRESPONDENT->id); if ($GLOBALS['page'] === 'editCorrespondent') { $_ADK_CORRESPONDENTS = new Correspondents(); $ADK_CORRESPONDENTS = new Correspondents(); $_ADK_CORRESPONDENTS->get($con); foreach ($_ADK_CORRESPONDENTS->correspondents as $corr) { if ($corr->id !== $ADK_CORRESPONDENT->id) { array_push($ADK_CORRESPONDENTS->correspondents, $corr); } } } $con->close();
$ADK_USER->get($con); $ADK_HIKES = new Hikes(); $ADK_HIKES->userid = $ADK_USER_ID; $ADK_HIKES->get($con); } $ADK_PEAKS = new Peaks(); $ADK_PEAKS->get($con); $ADK_GALLERY = new Gallery(); $ADK_GALLERY->userid = $ADK_USER_ID; if ($ADK_USERGROUP_CDE === 'COR') { $ADK_GALLERY->corrid = $_SESSION['ADK_USER_ID']; } $ADK_GALLERY->get($con); if ($ADK_USERGROUP_CDE !== 'HIK') { require_once 'includes/classes/Hiker.php'; $ADK_HIKERS = new Hikers(); $ADK_HIKERS->get($con, $ADK_USERGROUP_CDE === 'COR' ? $_SESSION['ADK_USER_ID'] : '%'); } $con->close(); function getTitle($photo) { $title = $photo->name; if ($photo->peaks != '') { $title .= "\n" . $photo->peaks; } if ($photo->username != '') { $title .= "\n" . $photo->username; } $title = str_replace(',', ', ', $title); return $title; }
} $ADK_MESSAGES = new Messages(); $ADK_MESSAGES->userid = $ADK_USER_ID; $ADK_MESSAGES->foldername = 'Inbox'; $ADK_MESSAGES->get($con); switch ($ADK_USERGROUP_CDE) { case 'ADM': require_once 'includes/classes/Template.php'; $ADK_MSG_TMPLS = new Templates(); $ADK_MSG_TMPLS->get($con, $_SESSION['ADK_USER_ID']); $ADK_HIKERS = new Hikers(); $ADK_HIKERS->get($con, $ADK_USER_ID); break; case 'COR': require_once 'includes/classes/Template.php'; $ADK_MSG_TMPLS = new Templates(); $ADK_MSG_TMPLS->get($con, $_SESSION['ADK_USER_ID']); $ADK_HIKERS = new Hikers(); $ADK_HIKERS->get($con, $ADK_USER_ID); break; case 'HIK': require_once 'includes/classes/Correspondent.php'; $ADK_HIKER = new Hiker(); $ADK_HIKER->id = $ADK_USER_ID; $ADK_HIKER->get($con); $ADK_CORRESPONDENT = new Correspondent(); $ADK_CORRESPONDENT->id = $ADK_HIKER->corrid; $ADK_CORRESPONDENT->get($con); break; } $con->close();
<?php //Imports require_once 'session.php'; require_once 'db/db_conn.php'; require_once 'db/SELECT.php'; require_once 'classes/Hiker.php'; require_once 'classes/Report.php'; if ($_SESSION['ADK_USERGROUP_CDE'] !== 'ADM') { http_response_code(404); exit; } $con = connect_db(); $ADK_HIKERS = new Hikers(); $ADK_HIKERS->get($con, '%'); $report = new Report(); $report->getHikersReport($ADK_HIKERS); $con->close(); $output = fopen('php://output', 'w'); header("Content-type:application/octet-stream"); header("Content-Disposition:attachment;filename=\"hikers.csv\""); echo $report->csv;