From 6cea6907528a50a86c4a52b7ec017253f4fa9a77 Mon Sep 17 00:00:00 2001 From: Arko Elsenaar Date: Thu, 14 Jul 2022 11:29:16 +0200 Subject: [PATCH] vote --- backend.php | 25 +++++++++++++++- index.php | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 106 insertions(+), 4 deletions(-) diff --git a/backend.php b/backend.php index 398015e..840cb15 100644 --- a/backend.php +++ b/backend.php @@ -46,6 +46,29 @@ http_response_code(418); break; + case "quoties": + $_GET['quoteid'] = random_int(1, iterator_count($bank)); + $quote = file_get_contents(__DIR__.'/bank/quote'.$_GET['quoteid'].'.mark'); + while(in_array($random_quote = random_int(1, iterator_count($bank)), [$_GET['quoteid']])); + $quote2 = file_get_contents(__DIR__.'/bank/quote'.$random_quote.'.mark'); + http_response_code(418); + $colors = []; + for ($i = 0; $i < 3; $i++) { $colors[] = random_int(1, 255); } + $rgb = join(',', $colors); + echo "

CLICK QUOTE TO CAST VOTE

"; + echo ""; + echo ""; + $quotes = [ $_GET['quoteid'] => $quote, $random_quote => $quote2 ]; + $count = 1; + foreach ($quotes as $quote_id => $quote) { + if ($count == 1) $otherelement = 'the next '; + else $otherelement = 'the previous '; + echo "" . $quote . ""; + $count++; + } + echo "
"; + break; + case 'img': if ($_SERVER['REQUEST_METHOD'] !== 'GET' || empty($_GET['html'])) { exit; @@ -121,4 +144,4 @@ function string_between_two_string($str, $starting_word, $ending_word) $size = strpos($str, $ending_word, $subtring_start) - $subtring_start; // Return the substring from the index substring_start of length size return substr($str, $subtring_start, $size); -} +} \ No newline at end of file diff --git a/index.php b/index.php index 712f23c..75f313f 100644 --- a/index.php +++ b/index.php @@ -37,8 +37,8 @@ - var(--eff-line-length) ) / 2)}*{--gap:calc(var(--rhythm) * var(--density));accent-color:var(--accent)} - + + @@ -224,6 +294,9 @@ function changeColorToExactlyWhatTheUserSelected() {
+ + +
@@ -275,8 +348,14 @@ function changeColorToExactlyWhatTheUserSelected() {
- + +