Пример #1
0
<?php

////Imports
require_once 'db/db_conn.php';
require_once 'db/SELECT.php';
require_once 'classes/Correspondent.php';
$con = connect_db();
$ADK_CORRESPONDENTS = new Correspondents();
$ADK_CORRESPONDENT_NAMES = $ADK_CORRESPONDENTS->getMatchingNames($con, $_GET['term']);
$con->close();
echo json_encode($ADK_CORRESPONDENT_NAMES);
http_response_code(200);
Пример #2
0
<?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();
Пример #3
0
<?php

//Imports
require_once 'session.php';
require_once 'db/db_conn.php';
require_once 'db/SELECT.php';
require_once 'classes/Correspondent.php';
require_once 'classes/Report.php';
if ($_SESSION['ADK_USERGROUP_CDE'] !== 'ADM') {
    http_response_code(404);
    exit;
}
$con = connect_db();
$ADK_CORRESPONDENTS = new Correspondents();
$ADK_CORRESPONDENTS->get($con);
$report = new Report();
$report->getCorrsReport($ADK_CORRESPONDENTS);
$con->close();
$output = fopen('php://output', 'w');
header("Content-type:application/octet-stream");
header("Content-Disposition:attachment;filename=\"correspondents.csv\"");
echo $report->csv;