62 lines
1.2 KiB
PHP
62 lines
1.2 KiB
PHP
<?php
|
|
$ValidAccess = 2010;
|
|
$sessionName = 'hotlunch';
|
|
session_name($sessionName);
|
|
session_start();
|
|
require_once("include/globals.php");
|
|
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
logExit("Session is not active",$moduleName);
|
|
exit;
|
|
}
|
|
|
|
// CSRF token validation
|
|
include "include/ajax.csrfToken.php";
|
|
|
|
|
|
|
|
// Set default timezone
|
|
date_default_timezone_set("Canada/Pacific");
|
|
$now = date("Y-m-d H:i:s",time());
|
|
|
|
$return_data = array();
|
|
|
|
$moduleName = "ajax.ToggleReporting.php";
|
|
// startLog($moduleName);
|
|
|
|
|
|
|
|
// Get parameters
|
|
$school_num = intval($_GET['school_num']);
|
|
|
|
// Ensure parameters are valid
|
|
|
|
if (!is_numeric($school_num)) logExit("School num is not numeric\n");
|
|
if ($school_num == 0) logExit("school_num is zero\n");
|
|
|
|
writeLog("school_num: $school_num\n");
|
|
|
|
|
|
// Get current setting
|
|
$query = "SELECT rep FROM schools WHERE record_num = $school_num";
|
|
writeLog("query: $query\n");
|
|
$rep = db_getVal($query);
|
|
|
|
switch ($rep) {
|
|
case 'R':
|
|
default:
|
|
$query = "UPDATE schools SET rep = 'N' WHERE record_num = $school_num";
|
|
break;
|
|
|
|
case 'N':
|
|
$query = "UPDATE schools SET rep = 'R' WHERE record_num = $school_num";
|
|
break;
|
|
}
|
|
|
|
writeLog("query: $query\n");
|
|
db_query($query);
|
|
|
|
writeLog("completed\n");
|
|
?>
|