Add on-demand XAMPP Lite 8.5 installer + Windows time.php support
- 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>
This commit is contained in:
@@ -6,13 +6,19 @@
|
||||
|
||||
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);
|
||||
|
||||
$settime = $_GET['lct'];
|
||||
$settime2 = round($settime/1000);
|
||||
$settime3 = "@".$settime2;
|
||||
|
||||
echo exec("sudo date -s $settime3 > /dev/null &");
|
||||
};
|
||||
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 &');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user