From 39aea7e99c52e6cf4a579ac629724ea1690959d4 Mon Sep 17 00:00:00 2001 From: Alex Fuchs Date: Sun, 4 Oct 2020 22:44:32 +0200 Subject: [PATCH] added thanks page --- css/bootstrap.css | 38 +++++++++++++++++++++----------------- index.php | 4 ++++ thanks.php | 32 ++++++++++++++++++++++++++++++++ upload.php | 2 +- vote.php | 46 ++++++++++++++++++++++++++++++++++++++-------- 5 files changed, 96 insertions(+), 26 deletions(-) create mode 100644 thanks.php diff --git a/css/bootstrap.css b/css/bootstrap.css index 36bfb2d..f4fbd7a 100644 --- a/css/bootstrap.css +++ b/css/bootstrap.css @@ -18,7 +18,7 @@ --white: #fff; --gray: #6c757d; --gray-dark: #343a40; - --primary: #007bff; + --primary: #ff852a; --secondary: #6c757d; --success: #28a745; --info: #17a2b8; @@ -60,7 +60,7 @@ body { line-height: 1.5; color: #212529; text-align: left; - background-color: #fff; + background-color: #212121; } [tabindex="-1"]:focus:not(:focus-visible) { @@ -76,6 +76,8 @@ hr { h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: 0.5rem; + font-family: "Barlow Condensed", sans-serif; + color: #fff; } p { @@ -581,8 +583,8 @@ pre code { display: flex; -ms-flex-wrap: wrap; flex-wrap: wrap; - margin-right: -15px; - margin-left: -15px; + margin-right: 0px; + margin-left: 0px; } .no-gutters { @@ -2543,21 +2545,21 @@ fieldset:disabled a.btn { .btn-primary { color: #fff; - background-color: #007bff; - border-color: #007bff; + background-color: #ff852a; + border-color: #ff852a; } .btn-primary:hover { color: #fff; - background-color: #0069d9; - border-color: #0062cc; + background-color: #d9781d; + border-color: #d9781d; } .btn-primary:focus, .btn-primary.focus { color: #fff; - background-color: #0069d9; - border-color: #0062cc; - box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5); + background-color: #d9781d; + border-color: #d9781d; + box-shadow: 0 0 0 0.2rem rgba(255, 133, 42, 0.5); } .btn-primary.disabled, .btn-primary:disabled { @@ -2569,13 +2571,13 @@ fieldset:disabled a.btn { .btn-primary:not(:disabled):not(.disabled):active, .btn-primary:not(:disabled):not(.disabled).active, .show > .btn-primary.dropdown-toggle { color: #fff; - background-color: #0062cc; - border-color: #005cbf; + background-color: #d9781d; + border-color: #d9781d; } .btn-primary:not(:disabled):not(.disabled):active:focus, .btn-primary:not(:disabled):not(.disabled).active:focus, .show > .btn-primary.dropdown-toggle:focus { - box-shadow: 0 0 0 0.2rem rgba(38, 143, 255, 0.5); + box-shadow: 0 0 0 0.2rem rgba(255, 133, 42, 0.5); } .btn-secondary { @@ -4854,8 +4856,8 @@ input[type="button"].btn-block { display: flex; -ms-flex-flow: row wrap; flex-flow: row wrap; - margin-right: -15px; - margin-left: -15px; + margin-right: 0px; + margin-left: 0px; } .card-deck .card { -ms-flex: 1 0 0%; @@ -10256,4 +10258,6 @@ a.text-dark:hover, a.text-dark:focus { border-color: #dee2e6; } } -/*# sourceMappingURL=bootstrap.css.map */ \ No newline at end of file +/*# sourceMappingURL=bootstrap.css.map */ + +/*Custom*/ diff --git a/index.php b/index.php index 1d6de34..378df9d 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,8 @@ @@ -7,6 +10,7 @@ +
diff --git a/thanks.php b/thanks.php new file mode 100644 index 0000000..402c008 --- /dev/null +++ b/thanks.php @@ -0,0 +1,32 @@ + + + + + +
+
+ +
+
+

Logo contest

+

Thanks for voting!

+
+ +
+
+
+ +
+
+ Go agane +
+
+ +'; + + + diff --git a/upload.php b/upload.php index db5cf3c..7c7b74a 100644 --- a/upload.php +++ b/upload.php @@ -1,5 +1,5 @@ 0) { $f = array_pop($_FILES); diff --git a/vote.php b/vote.php index 978e1e0..2692f0f 100644 --- a/vote.php +++ b/vote.php @@ -32,12 +32,19 @@ $query .= ($_POST['selected'] == $_POST['ID1'] ? $_POST['ID2'] : $_POST['ID1']).";"; $q = mysqli_query($remote,$query); + + $query = "insert into matchups values ('" . $_POST['matchID'] . "', "; + $query .= ($_POST['selected'] == $_POST['ID1'] ? $_POST['ID1'] : $_POST['ID2']).", "; + $query .= ($_POST['selected'] == $_POST['ID1'] ? $_POST['ID2'] : $_POST['ID1']).",'"; + $query .= session_id()."',default);"; + $q = mysqli_query($remote,$query); + } -if(!isset($_SESSION['count'])){ +if(!isset($_SESSION['numberLogos'])){ $query = "select count(id) from logos; "; $rCount = mysqli_query($remote,$query); - $_SESSION['count'] = mysqli_fetch_assoc($rCount)['count(id)']; + $_SESSION['numberLogos'] = mysqli_fetch_assoc($rCount)['count(id)']; //echo "queried!"; } @@ -45,17 +52,32 @@ $_SESSION['completed'] = []; } + +if(sizeof($_SESSION['completed']) > 20) { + + echo ' + + + + + Redirecting... + + +'; + exit(); +} + // To ensure that no logo pair is shown twice, we use a Cantor Pairing Function to store the information about the already shown pairs. $imageID1=0; $imageID2=0; -$maxcount= ($_SESSION['count'] * ($_SESSION['count'] - 1) / 2); //maximum retries, redundant? +$maxcount= ($_SESSION['numberLogos'] * ($_SESSION['numberLogos'] - 1) / 2); //maximum retries, redundant? for($i = 0; $i < $maxcount; $i++) { //get two different, random numbers do { - $imageID1 = rand(1,$_SESSION['count']); - $imageID2 = rand(1,$_SESSION['count']); + $imageID1 = rand(1,$_SESSION['numberLogos']); + $imageID2 = rand(1,$_SESSION['numberLogos']); } while ($imageID1 == $imageID2); @@ -83,6 +105,7 @@

Choose one!

+

'.sizeof($_SESSION['completed']).'/20

@@ -101,9 +124,16 @@ //image 1 $query = "select name,logo from logos where id = ".$imageID1." or id = ".$imageID2.";"; -$rImg1 = mysqli_query($remote,$query); -$Img1 = mysqli_fetch_assoc($rImg1); -$Img2 = mysqli_fetch_assoc($rImg1); +$rImg = mysqli_query($remote,$query); +if($imageID1 < $imageID2) { + $Img1 = mysqli_fetch_assoc($rImg); + $Img2 = mysqli_fetch_assoc($rImg); +} else { + $Img2 = mysqli_fetch_assoc($rImg); + $Img1 = mysqli_fetch_assoc($rImg); +} + +echo ''; echo ''; echo '';