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

32
counter.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
include "api.php";
if(isset($_GET["increment"])) {
query("UPDATE counter SET value = value + 1;");
header("Location: /counter.php");
die();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Vkládání otázek</title>
</head>
<body>
<h1>Počítadlo</h1>
<h2>
Je tu
<?php
query("SELECT * FROM counter", function($row) {
echo($row["value"]);
})
?>
lidí!
</h2>
<form action="/counter.php" method="get">
<input type="hidden" name="increment" value="dick">
<input type="submit" value="Přišel další!">
</form>
</body>
</html>