First Commit

This commit is contained in:
mark committed 2026-10-19 15:22:52 -07:00
1 parent 5eb9dd037d
commit 2e62c0e60b
11877 files changed
+2035312

No files matched your search

+75
View File
@@ -0,0 +1,75 @@
<?php
$ValidAccess = 2010;
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.StaffLocationUpdate.php";
// startLog($moduleName);
// Get parameters
$set = db_escape_string($_REQUEST['set']);
$location = intval($_REQUEST['location']);
// Validate parameters
$school_num = $school_record['record_num'];
// Error logging
writeLog("set: $set\n");
writeLog("location: $location\n");
switch ($set) {
case 'all':
$query = "UPDATE people " .
"SET meal_location = $location " .
"WHERE school_num = $school_num " .
"AND people_type = 'Staff'";
writeLog("query: $query\n");
db_query($query);
break;
case 'selected':
$query = "UPDATE people " .
"SET meal_location = $location " .
"WHERE school_num = $school_num " .
"AND meal_location IS NULL " .
"AND people_type = 'Staff'";
writeLog("query: $query\n");
db_query($query);
break;
case 'classroom':
$query = "UPDATE people " .
"SET meal_location = class_num " .
"WHERE school_num = $school_num " .
"AND class_num > 0 " .
"AND people_type = 'Staff'";
writeLog("query: $query\n");
db_query($query);
break;
}
writeLog("complete\n");
echo(json_encode($return_data));
?>