<?php
session_start();
error_reporting(0);
require_once('TCPDF-main/tcpdf.php');
include 'includes/database.php';
include 'includes/functions.php';

$conn = new Functions();
$redirect = $conn->base_url();

if (isset($_GET['name']) AND isset($_GET['exam']) AND isset($_GET['session'])
    AND isset($_GET['class']) AND isset($_GET['section'])) {

    $name = str_replace('-', ' ', $_GET['name']);
    $exam = str_replace('-', ' ', $_GET['exam']);
    $class = str_replace('-', ' ', $_GET['class']);
    $section = str_replace('-', ' ', $_GET['section']);
    $year = str_replace('-', '/', $_GET['session']);
    $zero = 0;
    $admin_url = $conn->base_url();

    // Include the flexible terminal report generator
    include_once 'flexible_terminal_report.php';

} else {
    // Return back to index page
    header("location: $redirect");
}

// Close and output PDF document
$pdf->Output('flexible_terminal_report.pdf', 'I');