- install/pqs_install.sql: one-shot installer (creates pqs DB + user, all tables as InnoDB, static seed) so a fresh portable XAMPP deploy needs no separate migrations. Derived from docs/pqs.sql with engines forced to InnoDB. - install/README.md: XAMPP Lite 8.5 deployment steps plus fresh-vs-upgrade guidance. - time.php: OS-aware clock set (PowerShell Set-Date on Windows/XAMPP, sudo date on Linux); epoch is int-cast so the exec has no injection. - .gitignore: exclude the portable xampp_lite_8_5/ stack (not versioned here). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
$dt = new DateTime('now');
|
|
$date = $dt->format('D M d Y H:i:s e');
|
|
echo "<p><strong>Current PQS Time: </strong></p>";
|
|
echo "<p>{$date}</p>";
|
|
|
|
if (isset($_GET['submit'])) {$submit=$_GET['submit'];}else{$submit='';}
|
|
if ($submit=='update'){
|
|
// Set the machine clock from the browser's time (air-gapped box has no NTP).
|
|
// $epoch is round(intval(...)) so it is a pure integer -- no shell injection.
|
|
$epoch = (int) round(((int)($_GET['lct'] ?? 0)) / 1000);
|
|
|
|
if (stripos(PHP_OS, 'WIN') === 0) {
|
|
// Windows / XAMPP: requires Apache (httpd) to be running as administrator.
|
|
$ps = 'Set-Date -Date ([DateTimeOffset]::FromUnixTimeSeconds(' . $epoch . ').LocalDateTime)';
|
|
exec('powershell -NoProfile -Command "' . $ps . '"');
|
|
} else {
|
|
// Linux: requires the web user to have passwordless sudo for date.
|
|
exec('sudo date -s @' . $epoch . ' > /dev/null &');
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
<p><strong>Local computer time:</Strong></p>
|
|
<p id="displaytime"></p>
|
|
|
|
<form name="ltime" method="get" action="">
|
|
<input type="hidden" name="lct" />
|
|
<p> <input type="submit" name="submit" value="update" />
|
|
</form>
|
|
|
|
<script>
|
|
var d = new Date();
|
|
document.forms['ltime'].elements['lct'].value = d.getTime();
|
|
document.getElementById("displaytime").innerHTML = d.toString();
|
|
|
|
setTimeout(function(){
|
|
window.location.href = "time.php";
|
|
}, 1000);
|
|
|
|
</script>
|
|
|