From 17acbd3bc0a4e2ece286c161b1aa3401b060cac5 Mon Sep 17 00:00:00 2001
From: Fabian
Date: Sun, 18 Oct 2026 05:20:26 +0100
Subject: [PATCH] Fix activation checks across start-date boundaries (#395)
---
GameEngine/Account.php | 2 +-
Templates/activate/activate.tpl | 16 +-
activate.php | 7 +-
src/Utils/DateTime.php | 53 +++++-
tests/regression/ServerStartTimeTest.php | 210 +++++++++++++++++++++++
5 files changed, 276 insertions(+), 12 deletions(-)
create mode 100644 tests/regression/ServerStartTimeTest.php
diff --git a/GameEngine/Account.php b/GameEngine/Account.php
index 9c1fbe90..b3b9287a 100755
--- a/GameEngine/Account.php
+++ b/GameEngine/Account.php
@@ -223,7 +223,7 @@ class Account {
global $database;
// ==================== VERIFICARE DATA DE START A SERVERULUI ====================
- if (START_DATE < date('d.m.Y') || (START_DATE === date('d.m.Y') && START_TIME <= date('H:i'))) {
+ if (\App\Utils\DateTime::hasServerStarted(START_DATE, START_TIME)) {
// Caută codul de activare în tabela activate
$code = trim($_POST['id'] ?? '');
diff --git a/Templates/activate/activate.tpl b/Templates/activate/activate.tpl
index 0a3ebaf1..74f1cb87 100644
--- a/Templates/activate/activate.tpl
+++ b/Templates/activate/activate.tpl
@@ -45,10 +45,10 @@ if(isset($show)){
- date('d.m.y') || START_DATE == date('d.m.y') && START_TIME <= date('H:i')){ ?>
+
+}elseif($serverHasStarted){ ?>
\ No newline at end of file
+?>
diff --git a/activate.php b/activate.php
index ae376d90..89848934 100644
--- a/activate.php
+++ b/activate.php
@@ -25,6 +25,9 @@ use App\Utils\AccessLogger;
include('GameEngine/Account.php');
AccessLogger::logRequest();
+$serverStartTimestamp = \App\Utils\DateTime::getServerStartTimestamp(START_DATE, START_TIME);
+$serverHasStarted = $serverStartTimestamp !== null && time() >= $serverStartTimestamp;
+
?>
@@ -56,7 +59,7 @@ AccessLogger::logRequest();