Your IP : 216.73.217.79


Current Path : /var/www/cesa.co.za/php/
Upload File :
Current File : /var/www/cesa.co.za/php/member_portal_becs.php

<?php

// ini_set('display_errors', 1);
// error_reporting(E_ALL);

if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') {
    // Force HTTPS
    $redirect = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: ' . $redirect);
    exit();
}

$sessid = session_id();
if (empty($sessid)) {
    session_start([
        'cookie_lifetime' => 86400,
    ]);
    $sessid = session_id();
}
$_COOKIE["PHPSESSID"] = $sessid;
include_once($_SERVER['DOCUMENT_ROOT'] . '/php/inc_db.php');
include_once($_SERVER['DOCUMENT_ROOT'] . '/cesanet/inc_shared.php');

$fileUploadObj = new FileUploads($sqlf);

$arrFiles = $fileUploadObj->findBecsFiles();
// Get the URL of the current page without any URL variables
$url = $_SERVER['REQUEST_URI'];
$url = str_replace('?page=becs', '', $url);

if ($env != 'dev') {
    $url = '/login/';
}
?>

<table class="table">
    <tr>
        <td align="left">
            <h2>BECS Reports</h2>
            <p>The following BECS reports are available for download:</p>
        </td>
        <td align="right">
            <a href="<?php echo $url; ?>">Back to Member Portal</a>
        </td>
    </tr>
</table>
<table class="table table-bordered">
    <tr>
        <th>File Name</th>
    </tr>
    <?php

    $latestDate = null;
    $archiveDispaly = true;

    foreach ($arrFiles as $file) {
        
        if ($latestDate == null) {
            $latestDate = new DateTime($file['DateUploaded']);
        }
        
        $fileDate = new DateTime($file['DateUploaded']);

        if ($archiveDispaly && $latestDate->getTimestamp() - (3600 * 24 * 90) > $fileDate->getTimestamp()) {
            ?>
            <tr>
                <th>
                    Archived
                </th>
            </tr>
            <?php
            $archiveDispaly = false;
        }

        ?>
        <tr>
            <td><a href="/uploads/<?php echo $file['DocFile'] ?>" target="_blank"><?php echo $file['DocFile'] . ' (' . $fileDate->format('j F Y') . ')' ?></a></td>
        </tr>
        <?php
    }
    ?>
</table>
<?php

include_once($_SERVER['DOCUMENT_ROOT'] . '/php/templates/inc_footer.php');