Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<h3 style='text-align:center;'>CLICK QUOTE TO CAST VOTE</h3>";
echo "<style>#votecontainer a { transition: 2s opacity; width: 50%; float: left; display: block; } #votecontainer a:hover { background:rgb($rgb); }</style>";
echo "<style>#votecontainer a.fadeout { opacity: 0; }</style>";
$quotes = [ $_GET['quoteid'] => $quote, $random_quote => $quote2 ];
$count = 1;
foreach ($quotes as $quote_id => $quote) {
if ($count == 1) $otherelement = 'the next <a/>';
else $otherelement = 'the previous <a/>';
echo "<a href='javascript:void()' _='on click add .fadeout to $otherelement then wait 2s then trigger click on #tab-2' id={$quote_id}>" . $quote . "</a>";
$count++;
}
echo "<div style='clear:both'></div>";
break;

case 'img':
if ($_SERVER['REQUEST_METHOD'] !== 'GET' || empty($_GET['html'])) {
exit;
Expand Down Expand Up @@ -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);
}
}
Loading