}
        $query->free();
    }
} else {
    die('Database not connected.  Please check your config file for proper installation.');
}
session_start();
require 'includes/classes/login.php';
$login = new Login();
$adminUser = $login->get_user('admin');
//print_r($adminUser);
$okFiles = array('login.php', 'signup.php', 'password_reset.php', 'getHtmlScores.php');
if (!in_array(basename($_SERVER['PHP_SELF']), $okFiles) && (empty($_SESSION['logged']) || $_SESSION['logged'] !== 'yes')) {
    header('Location: login.php');
    exit;
} else {
    if (!empty($_SESSION['loggedInUser'])) {
        $user = $login->get_user($_SESSION['loggedInUser']);
    }
}
if ($_SESSION['loggedInUser'] === 'admin' && $_SESSION['logged'] === 'yes') {
    //$isAdmin = 1;
} else {
    //$isAdmin = 0;
    //get current week
    $currentWeek = getCurrentWeek();
    $cutoffDateTime = getCutoffDateTime($currentWeek);
    $firstGameTime = getFirstGameTime($currentWeek);
    $firstGameExpired = date("U", time() + SERVER_TIMEZONE_OFFSET * 3600) > strtotime($firstGameTime) ? true : false;
    $weekExpired = date("U", time() + SERVER_TIMEZONE_OFFSET * 3600) > strtotime($cutoffDateTime) ? true : false;
}
Exemple #2
0
        $addresses .= (strlen($addresses) > 0 ? ', ' : '') . $result['email'];
        $mail->AddAddress(MAILING_LIST);
        $mail->Subject = $user->userName . " has entered picks";
        // html text block
        $mail->Body = "Picks: {$pickText}, Best Bet = {$bbTeam}";
        $mail->Send();
    }
    header('Location: results.php?week=' . $_POST['week']);
    exit;
} else {
    $week = (int) $_GET['week'];
    if (empty($week)) {
        //get current week
        $week = (int) getCurrentWeek();
    }
    $cutoffDateTime = getCutoffDateTime($week);
    $firstGameTime = getFirstGameTime($week);
}
include 'includes/header.php';
?>
	<script type="text/javascript">
	function checkform() {
		//make sure all picks have a checked value
		var f = document.entryForm;
		var allChecked = true;
		var allR = document.getElementsByTagName('input');
		for (var i=0; i < allR.length; i++) {
			if(allR[i].type == 'radio') {
				if (!radioIsChecked(allR[i].name)) {
					allChecked = false;
				}