From 5b9cda2ed21cd7823d414700795d7bb181d0af6c Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Wed, 18 Feb 2026 21:18:37 -0700 Subject: [PATCH] Add a counter for colors named --- incl/util.php | 4 ++++ webroot/index.php | 6 ++++++ webroot/upload.php | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 incl/util.php diff --git a/incl/util.php b/incl/util.php new file mode 100644 index 0000000..090531b --- /dev/null +++ b/incl/util.php @@ -0,0 +1,4 @@ +prepare("SELECT * FROM colors ORDER BY timestamp DESC"); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); +$total = 255 * 255 * 255; +$named = count($result); +$remaining = $total - $named; + $lastInsertId = $_GET['highlight'] ?? null; ?> @@ -111,6 +116,7 @@ $lastInsertId = $_GET['highlight'] ?? null;

Name A Color!

+

/ colors named ( left)


Name your own color!

diff --git a/webroot/upload.php b/webroot/upload.php index 3ce6f43..846a29e 100644 --- a/webroot/upload.php +++ b/webroot/upload.php @@ -34,7 +34,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { echo "Couldn't validate Captcha"; exit; } - + $conn = connectToDatabase(); $color = $_POST['color'];