Compare commits
4 Commits
b6e5b1e806
...
main
Author | SHA1 | Date | |
---|---|---|---|
b08110e3e0 | |||
24a8b4758d | |||
1dba222b4a | |||
83dab7d940 |
13
api.php
13
api.php
@@ -82,6 +82,19 @@
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;");
|
) 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"])) {
|
if(isset($_GET["cmd"])) {
|
||||||
$cmd = $_GET['cmd'];
|
$cmd = $_GET['cmd'];
|
||||||
|
|
||||||
|
32
counter.php
Normal file
32
counter.php
Normal 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>
|
||||||
|
|
12
index.php
12
index.php
@@ -27,7 +27,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Moderace otázek</title>
|
<title>Audience questions</title>
|
||||||
<style>
|
<style>
|
||||||
table {
|
table {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
@@ -65,6 +65,14 @@
|
|||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<?php
|
||||||
|
query("SELECT COUNT(`id`) as `count` FROM `for_stallman`;", function($row) {
|
||||||
|
if($row["count"] <= 0) {
|
||||||
|
echo "<meta http-equiv=\"refresh\" content=\"3\">";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
?>
|
||||||
<h1>Audience questions</h1>
|
<h1>Audience questions</h1>
|
||||||
<p>
|
<p>
|
||||||
<a href="/index.php">Load new questions</a>
|
<a href="/index.php">Load new questions</a>
|
||||||
@@ -104,7 +112,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<form action="/index.php" method="get">
|
<form action="/index.php" method="get">
|
||||||
<input type="hidden" name="deletemessage" value="' . $row["id"] . '">
|
<input type="hidden" name="deletemessage" value="' . $row["id"] . '">
|
||||||
<input type="submit" value="Delete" style="color: red;">
|
<input type="submit" value="Delete" style="color: darkred;">
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@@ -62,6 +62,13 @@
|
|||||||
padding-left: 4px;
|
padding-left: 4px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<?php
|
||||||
|
query("SELECT COUNT(`id`) as `count` FROM `for_moderation`;", function($row) {
|
||||||
|
if($row["count"] <= 0) {
|
||||||
|
echo "<meta http-equiv=\"refresh\" content=\"3\">";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
?>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Moderace otázek pro pana Stallmana</h1>
|
<h1>Moderace otázek pro pana Stallmana</h1>
|
||||||
|
Reference in New Issue
Block a user