Implemented counter

This commit is contained in:
2025-05-07 14:52:49 +02:00
parent 24a8b4758d
commit b08110e3e0
2 changed files with 45 additions and 0 deletions

13
api.php
View File

@@ -82,6 +82,19 @@
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
}
if(!in_array("counter", $tables)) {
query("CREATE TABLE `counter` (
`value` int NOT NULL,
PRIMARY KEY (`value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
}
query("SELECT COUNT(value) AS count FROM counter;", function($row) {
if($row["count"] <= 0) {
query("INSERT INTO counter(value) VALUES (0);");
}
});
if(isset($_GET["cmd"])) {
$cmd = $_GET['cmd'];