<?php
$date = date("l");
$time = date("G");

$setDay = 'Friday';
$setTime = 13;
$setMaxTime = 24;

$check = strtotime("next $setDay $setTime:00");

//print($date);
//print($time);
//print($check);

$notshow = true;

if ($date == $setDay) {
    $check = strtotime("this $setDay $setTime:00");

    if ($time >= $setTime && $time <= $setMaxTime) {
        $notshow = false;
    }
}

$todate = date('M d, Y H:i', $check);

$_url = explode('?', $_SERVER['REQUEST_URI']);

$url = explode("/", $_url[0]);

if (in_array('top90', $url)) {
    $notshow = false;
}

$notshow = false;

if ($notshow) {
    $now = time();
    $secondsRemaining = $check - $now;

    define('SECONDS_PER_MINUTE', 60);
    define('SECONDS_PER_HOUR', 3600);
    define('SECONDS_PER_DAY', 86400);

    $daysRemaining = floor($secondsRemaining / SECONDS_PER_DAY); //days until end
    $secondsRemaining -= ($daysRemaining * SECONDS_PER_DAY); //update variable

    $hoursRemaining = floor($secondsRemaining / SECONDS_PER_HOUR); //hours until end
    $secondsRemaining -= ($hoursRemaining * SECONDS_PER_HOUR); //update variable

    $minutesRemaining = floor($secondsRemaining / SECONDS_PER_MINUTE); //minutes until end
    $secondsRemaining -= ($minutesRemaining * SECONDS_PER_MINUTE); //update variable

    $until = "<br /><h3>";
    $until .= "We will start in ";
    if ($daysRemaining > 0) {
        $until .= $daysRemaining." days, ";
    }
    if ($hoursRemaining > 0) {
        $until .= $hoursRemaining." hours, ";
    }
    if ($minutesRemaining > 0) {
        $until .= $minutesRemaining." minutes, ";
    }
    if ($secondsRemaining > 0) {
        $until .= $secondsRemaining." seconds ";
    }
    $until .= "again";
    $until .= "</h3>";

    header("HTTP/1.0 503 Service Unavailable", true, 503);
    header("Retry-After: 14400");
    require "inMaintenance.html";

    exit(0);
}

    /** @defined "__APPLICATION_PATH" "/../application/" */
    define('__APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application') . '/');
    include_once(__APPLICATION_PATH . 'bootstrap.php');