Add a counter for colors named
This commit is contained in:
2 files changed
+10
No files matched your search
@@ -0,0 +1,4 @@
|
|||||||
|
<?php
|
||||||
|
function formatWithCommas($number) {
|
||||||
|
return number_format($number, 0, '.', ',');
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
include __DIR__ . "/../config/captcha.php";
|
include __DIR__ . "/../config/captcha.php";
|
||||||
include __DIR__ . "/../incl/db.php";
|
include __DIR__ . "/../incl/db.php";
|
||||||
|
include __DIR__ . "/../incl/util.php";
|
||||||
|
|
||||||
$conn = connectToDatabase();
|
$conn = connectToDatabase();
|
||||||
|
|
||||||
@@ -8,6 +9,10 @@ $stmt = $conn->prepare("SELECT * FROM colors ORDER BY timestamp DESC");
|
|||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$total = 255 * 255 * 255;
|
||||||
|
$named = count($result);
|
||||||
|
$remaining = $total - $named;
|
||||||
|
|
||||||
$lastInsertId = $_GET['highlight'] ?? null;
|
$lastInsertId = $_GET['highlight'] ?? null;
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -111,6 +116,7 @@ $lastInsertId = $_GET['highlight'] ?? null;
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Name A Color!</h1>
|
<h1>Name A Color!</h1>
|
||||||
|
<p><?= formatWithCommas($named) ?>/<?= formatWithCommas($total) ?> colors named (<?= formatWithCommas($remaining) ?> left)</p>
|
||||||
<hr>
|
<hr>
|
||||||
<h2>Name your own color!</h2>
|
<h2>Name your own color!</h2>
|
||||||
<form action="upload.php" method="post">
|
<form action="upload.php" method="post">
|
||||||
|
|||||||
Reference in new issue
Block a user