Item #4: centralize timezone, collapse the 16 pod branches to loops
- includes/db.php now defines PQS_TIMEZONE and sets it on include; the 9 files
that hardcoded date_default_timezone_set('America/Chicago') drop the call
(main pages already load db.php; display includes now require it).
- console.php: pod load and the 16 pod-checkbox lines collapsed into loops over
a $pods array (fixed 16 kept - hardware max). Output unchanged.
Verified: timezone resolves to America/Chicago via the constant; console commit,
config update, and pod-checkbox rendering all correct; registration suite green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
//var_dump($_GET);
|
//var_dump($_GET);
|
||||||
|
|
||||||
require_once("includes/config.php");
|
require_once("includes/config.php");
|
||||||
date_default_timezone_set('America/Chicago');
|
require_once("includes/db.php");
|
||||||
$tdate = date('Ymd');
|
$tdate = date('Ymd');
|
||||||
$ttime = date('Hi');
|
$ttime = date('Hi');
|
||||||
$isLight = false;
|
$isLight = false;
|
||||||
|
|||||||
+14
-36
@@ -20,7 +20,6 @@ var auto_refreshpods = setInterval(function() {
|
|||||||
require_once("includes/config.php");
|
require_once("includes/config.php");
|
||||||
require_once("includes/db.php");
|
require_once("includes/db.php");
|
||||||
require_once("includes/queue.php");
|
require_once("includes/queue.php");
|
||||||
date_default_timezone_set('America/Chicago');
|
|
||||||
$ttime = date('Hi');
|
$ttime = date('Hi');
|
||||||
$numberpods = 0;
|
$numberpods = 0;
|
||||||
//var_dump($_SESSION);
|
//var_dump($_SESSION);
|
||||||
@@ -179,25 +178,11 @@ while ($line = mysqli_fetch_array($result)) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = 'SELECT * FROM pqs_pods';
|
$pods = array();
|
||||||
$result = mysqli_query($link, $query) or die('Query failed: ' . mysqli_error($link));
|
foreach (pqs_rows('SELECT * FROM pqs_pods') as $line) {
|
||||||
while ($line = mysqli_fetch_array($result)) {
|
for ($i = 1; $i <= 16; $i++) {
|
||||||
$pod01 = $line[0];
|
$pods[$i] = (int) $line[sprintf('pod%02d', $i)];
|
||||||
$pod02 = $line[1];
|
}
|
||||||
$pod03 = $line[2];
|
|
||||||
$pod04 = $line[3];
|
|
||||||
$pod05 = $line[4];
|
|
||||||
$pod06 = $line[5];
|
|
||||||
$pod07 = $line[6];
|
|
||||||
$pod08 = $line[7];
|
|
||||||
$pod09 = $line[8];
|
|
||||||
$pod10 = $line[9];
|
|
||||||
$pod11 = $line[10];
|
|
||||||
$pod12 = $line[11];
|
|
||||||
$pod13 = $line[12];
|
|
||||||
$pod14 = $line[13];
|
|
||||||
$pod15 = $line[14];
|
|
||||||
$pod16 = $line[15];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -238,22 +223,15 @@ while ($line = mysqli_fetch_array($result)) {
|
|||||||
<br>
|
<br>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if ("$pod01" == 0) {echo "<font color=red>Pod01 : </font>";} else {echo "Pod01 : ";} if ("$pod01" == 1) { echo "<input type='checkbox' id='pod01' name='pod01' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod01' name='pod01' /><br>"; }
|
for ($i = 1; $i <= 16; $i++) {
|
||||||
if ("$pod02" == 0) {echo "<font color=red>Pod02 : </font>";} else {echo "Pod02 : ";} if ("$pod02" == 1) { echo "<input type='checkbox' id='pod02' name='pod02' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod02' name='pod02' /><br>"; }
|
$name = sprintf('pod%02d', $i);
|
||||||
if ("$pod03" == 0) {echo "<font color=red>Pod03 : </font>";} else {echo "Pod03 : ";} if ("$pod03" == 1) { echo "<input type='checkbox' id='pod03' name='pod03' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod03' name='pod03' /><br>"; }
|
$label = sprintf('Pod%02d', $i);
|
||||||
if ("$pod04" == 0) {echo "<font color=red>Pod04 : </font>";} else {echo "Pod04 : ";} if ("$pod04" == 1) { echo "<input type='checkbox' id='pod04' name='pod04' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod04' name='pod04' /><br>"; }
|
if (!empty($pods[$i])) {
|
||||||
if ("$pod05" == 0) {echo "<font color=red>Pod05 : </font>";} else {echo "Pod05 : ";} if ("$pod05" == 1) { echo "<input type='checkbox' id='pod05' name='pod05' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod05' name='pod05' /><br>"; }
|
echo "$label : <input type='checkbox' id='$name' name='$name' class='checkbox' checked /><br>";
|
||||||
if ("$pod06" == 0) {echo "<font color=red>Pod06 : </font>";} else {echo "Pod06 : ";} if ("$pod06" == 1) { echo "<input type='checkbox' id='pod06' name='pod06' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod06' name='pod06' /><br>"; }
|
} else {
|
||||||
if ("$pod07" == 0) {echo "<font color=red>Pod07 : </font>";} else {echo "Pod07 : ";} if ("$pod07" == 1) { echo "<input type='checkbox' id='pod07' name='pod07' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod07' name='pod07' /><br>"; }
|
echo "<font color=red>$label : </font><input type='checkbox' class='checkbox' id='$name' name='$name' /><br>";
|
||||||
if ("$pod08" == 0) {echo "<font color=red>Pod08 : </font>";} else {echo "Pod08 : ";} if ("$pod08" == 1) { echo "<input type='checkbox' id='pod08' name='pod08' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod08' name='pod08' /><br>"; }
|
}
|
||||||
if ("$pod09" == 0) {echo "<font color=red>Pod09 : </font>";} else {echo "Pod09 : ";} if ("$pod09" == 1) { echo "<input type='checkbox' id='pod09' name='pod09' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod09' name='pod09' /><br>"; }
|
}
|
||||||
if ("$pod10" == 0) {echo "<font color=red>Pod10 : </font>";} else {echo "Pod10 : ";} if ("$pod10" == 1) { echo "<input type='checkbox' id='pod10' name='pod10' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod10' name='pod10' /><br>"; }
|
|
||||||
if ("$pod11" == 0) {echo "<font color=red>Pod11 : </font>";} else {echo "Pod11 : ";} if ("$pod11" == 1) { echo "<input type='checkbox' id='pod11' name='pod11' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod11' name='pod11' /><br>"; }
|
|
||||||
if ("$pod12" == 0) {echo "<font color=red>Pod12 : </font>";} else {echo "Pod12 : ";} if ("$pod12" == 1) { echo "<input type='checkbox' id='pod12' name='pod12' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod12' name='pod12' /><br>"; }
|
|
||||||
if ("$pod13" == 0) {echo "<font color=red>Pod13 : </font>";} else {echo "Pod13 : ";} if ("$pod13" == 1) { echo "<input type='checkbox' id='pod13' name='pod13' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod13' name='pod13' /><br>"; }
|
|
||||||
if ("$pod14" == 0) {echo "<font color=red>Pod14 : </font>";} else {echo "Pod14 : ";} if ("$pod14" == 1) { echo "<input type='checkbox' id='pod14' name='pod14' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod14' name='pod14' /><br>"; }
|
|
||||||
if ("$pod15" == 0) {echo "<font color=red>Pod15 : </font>";} else {echo "Pod15 : ";} if ("$pod15" == 1) { echo "<input type='checkbox' id='pod15' name='pod15' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod15' name='pod15' /><br>"; }
|
|
||||||
if ("$pod16" == 0) {echo "<font color=red>Pod16 : </font>";} else {echo "Pod16 : ";} if ("$pod16" == 1) { echo "<input type='checkbox' id='pod16' name='pod16' class='checkbox' checked /><br>"; } else { echo "<input type='checkbox' class='checkbox' id='pod16' name='pod16' /><br>"; }
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
Visability : <select name='visibility' >
|
Visability : <select name='visibility' >
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ const PQS_DB_USER = 'pqs';
|
|||||||
const PQS_DB_PASS = 'pqs';
|
const PQS_DB_PASS = 'pqs';
|
||||||
const PQS_DB_NAME = 'pqs';
|
const PQS_DB_NAME = 'pqs';
|
||||||
|
|
||||||
|
// Single source of truth for the venue's timezone. Set on include so every
|
||||||
|
// page that pulls in db.php gets it without repeating the call.
|
||||||
|
const PQS_TIMEZONE = 'America/Chicago';
|
||||||
|
date_default_timezone_set(PQS_TIMEZONE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared mysqli connection, opened once per request.
|
* Shared mysqli connection, opened once per request.
|
||||||
* mysqli is put into exception-reporting mode (the default since PHP 8.1) so
|
* mysqli is put into exception-reporting mode (the default since PHP 8.1) so
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('America/Chicago');
|
require_once __DIR__ . '/db.php';
|
||||||
$locked = 0;
|
$locked = 0;
|
||||||
$numplayers = 0;
|
$numplayers = 0;
|
||||||
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('America/Chicago');
|
require_once __DIR__ . '/db.php';
|
||||||
$group = isset($_POST['group']) ? (int)$_POST['group'] : 0;
|
$group = isset($_POST['group']) ? (int)$_POST['group'] : 0;
|
||||||
|
|
||||||
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('America/Chicago');
|
require_once __DIR__ . '/db.php';
|
||||||
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
||||||
mysqli_select_db($link, 'pqs') or die('Could not select database');
|
mysqli_select_db($link, 'pqs') or die('Could not select database');
|
||||||
$query = "SELECT * FROM pqs_queue ORDER BY MissionID, ID";
|
$query = "SELECT * FROM pqs_queue ORDER BY MissionID, ID";
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('America/Chicago');
|
require_once __DIR__ . '/db.php';
|
||||||
$numplayers = 0;
|
$numplayers = 0;
|
||||||
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
||||||
mysqli_select_db($link, 'pqs') or die('Could not select database');
|
mysqli_select_db($link, 'pqs') or die('Could not select database');
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<?Php
|
<?Php
|
||||||
date_default_timezone_set('America/Chicago');
|
require_once __DIR__ . '/db.php';
|
||||||
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
$link = mysqli_connect('localhost', 'pqs', 'pqs') or die('Could not connect: ' . mysqli_error($link));
|
||||||
mysqli_select_db($link, 'pqs') or die('Could not select database');
|
mysqli_select_db($link, 'pqs') or die('Could not select database');
|
||||||
$query = "SELECT * FROM pqs_gameconfig";
|
$query = "SELECT * FROM pqs_gameconfig";
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ var auto_refreshqueue = setInterval(function() {
|
|||||||
include_once("includes/config.php");
|
include_once("includes/config.php");
|
||||||
require_once("includes/db.php");
|
require_once("includes/db.php");
|
||||||
require_once("includes/queue.php");
|
require_once("includes/queue.php");
|
||||||
date_default_timezone_set('America/Chicago');
|
|
||||||
$tdate = date('Ymd');
|
$tdate = date('Ymd');
|
||||||
$ttime = date('Hi');
|
$ttime = date('Hi');
|
||||||
$missionsize = $_SESSION['mechpods'];
|
$missionsize = $_SESSION['mechpods'];
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body style='background: #000;'>
|
<body style='background: #000;'>
|
||||||
<?php
|
<?php
|
||||||
date_default_timezone_set('America/Chicago');
|
require_once("includes/db.php");
|
||||||
//include_once("includes/config.php");
|
//include_once("includes/config.php");
|
||||||
//var_dump($_GET);
|
//var_dump($_GET);
|
||||||
if (isset($_GET['callsign'])){
|
if (isset($_GET['callsign'])){
|
||||||
|
|||||||
Reference in New Issue
Block a user