diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/TODO b/TODO new file mode 100644 index 0000000..42bd52b --- /dev/null +++ b/TODO @@ -0,0 +1,25 @@ +change cookie for userLogged to be much more secure + + +Move code into classes/functions, and modularise it + +Build the entities that we need, and call them in the code + +add functionality to + +make team +add player +join tournament (request to join) +when tourney has enough applicats, then arrange the matches for first seeds +make tourney + +show match page +have elo changes seperate +have matchmaking seperate + +front-controller +https://symfony.com/doc/current/introduction/from_flat_php_to_symfony.html#a-front-controller-to-the-rescue + + +Seperate logic from any front end (logic needs to be able to run via command line) +it can return what is needed for the front end only diff --git a/css/alert.scss b/css/alert.scss new file mode 100644 index 0000000..3471964 --- /dev/null +++ b/css/alert.scss @@ -0,0 +1,23 @@ +.alert{ + width: 100%; + padding: 12px; + border-radius: 6px; +} +.alert--notification{ + @extend .alert; + background-color: $notification; +} +.alert--success{ + @extend .alert; + background-color: $success; +} +.alert--error{ + @extend .alert; + background-color: $error; + color: $white; +} +.alert--alert{ + @extend .alert; + background-color: $alert; +} + diff --git a/css/colours.scss b/css/colours.scss new file mode 100644 index 0000000..1977e0c --- /dev/null +++ b/css/colours.scss @@ -0,0 +1,12 @@ +$gunmetal: #2A2D34; +$ghost-white: #F8F8FF; +$steel-blue: #3E7CB1; +$white: #FFF; +$black: #000; + +$offyellow: #FEFAE0; +$success: #35CE8D; +$error: #AD2831; +$notification: #06BEE1; +$alert: lightgoldenrodyellow; + diff --git a/css/footer.scss b/css/footer.scss new file mode 100644 index 0000000..4765e62 --- /dev/null +++ b/css/footer.scss @@ -0,0 +1,13 @@ +footer{ + background-color: $gunmetal; + color: $white; +} +.footer__link{ + text-decoration: none; + color: $ghost-white; + + &:hover{ + color: $notification; + } +} + diff --git a/css/form.scss b/css/form.scss new file mode 100644 index 0000000..f17f130 --- /dev/null +++ b/css/form.scss @@ -0,0 +1,80 @@ +@mixin input { + appearance: none; + + padding: 12px; + font-size: 16px; + margin-bottom: 12px; + + background: $white; + border: 2px solid $black; + box-sizing: border-box; + color: $black; + display: block; + line-height: 1; + outline: 2px solid transparent; + vertical-align: top; + + transition-property: background-color, border-color, color, opacity, box-shadow; + transition-duration: .1s; + transition-timing-function: ease-out; + + &:focus { + border-color: $notification; + box-shadow: $notification; + outline: 0 none; + outline-offset: 0; + } + + &:invalid { + outline: 0 none; + } +} + +select, textarea{ + @include input; +} +textarea{ + // Allow only vertical resizing of textareas. + resize: vertical; +} + +input { + &[type='text'], + &[type='number'], + &[type='email'], + &[type='password'] { + @include input; + } +} + +.button, +button, +[type="button"], +[type="reset"], +[type="submit"]{ + -webkit-appearance: button; + cursor: pointer; + + padding: 10px 26px; + margin: 0.6rem 0; + border: 2px solid $gunmetal; + background-color: $gunmetal; + color: $white; + text-decoration: none; + display: inline-block; + border-radius: 4px; + font-weight: bold; + font-size: 16px; + + &:hover{ + background-color: lighten($gunmetal, 10%); + border-color: lighten($gunmetal, 10%); + color: $white; + } + + // Remove margin from paragraph wrapped anchors + p &{ + margin: 0; + } +} + diff --git a/css/header.scss b/css/header.scss new file mode 100644 index 0000000..ca52262 --- /dev/null +++ b/css/header.scss @@ -0,0 +1,62 @@ +header{ + width: 100%; + background-color: $gunmetal; + padding: 16px; +} +header .layout-wrapper{ + position: relative; +} +header .layout-wrapper *{ + display: inline-block; + vertical-align: middle; +} + +nav{ + //position: absolute; + right: 0; + vertial-align: middle; + display: inline-block; +} +nav ul{ + list-style: none; + margin: 0; + padding: 0; +} +nav ul li{ + display: inline; + color: $ghost-white; + padding: 4px 8px; +} +nav ul li a{ + text-decoration: none; + color: $ghost-white; + padding: 4px 8px; + + &:hover{ + color: $white; + } +} +nav ul li ul{ + border-top: 16px solid transparent; + z-index: $zi-high; +} +// Prevent webkit fucking shit up +nav ul > li:before { + content: "\200B"; + position: absolute; +} +.site-title{ + color: $ghost-white; + padding: 6px; + text-decoration: none; + font-weight: bold; + font-size: 16px; + vertial-align: middle; + display: inline-block; +} +.logo{ + fill: $ghost-white; + width: 32px; + height: 32px; +} + diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000..167608e --- /dev/null +++ b/css/main.css @@ -0,0 +1,246 @@ +@charset "UTF-8"; +select, textarea { + appearance: none; + padding: 12px; + font-size: 16px; + margin-bottom: 12px; + background: #FFF; + border: 2px solid #000; + box-sizing: border-box; + color: #000; + display: block; + line-height: 1; + outline: 2px solid transparent; + vertical-align: top; + transition-property: background-color, border-color, color, opacity, box-shadow; + transition-duration: 0.1s; + transition-timing-function: ease-out; +} +select:focus, textarea:focus { + border-color: #06BEE1; + box-shadow: #06BEE1; + outline: 0 none; + outline-offset: 0; +} +select:invalid, textarea:invalid { + outline: 0 none; +} + +textarea { + resize: vertical; +} + +input[type=text], input[type=number], input[type=email], input[type=password] { + appearance: none; + padding: 12px; + font-size: 16px; + margin-bottom: 12px; + background: #FFF; + border: 2px solid #000; + box-sizing: border-box; + color: #000; + display: block; + line-height: 1; + outline: 2px solid transparent; + vertical-align: top; + transition-property: background-color, border-color, color, opacity, box-shadow; + transition-duration: 0.1s; + transition-timing-function: ease-out; +} +input[type=text]:focus, input[type=number]:focus, input[type=email]:focus, input[type=password]:focus { + border-color: #06BEE1; + box-shadow: #06BEE1; + outline: 0 none; + outline-offset: 0; +} +input[type=text]:invalid, input[type=number]:invalid, input[type=email]:invalid, input[type=password]:invalid { + outline: 0 none; +} + +.button, +button, +[type=button], +[type=reset], +[type=submit] { + -webkit-appearance: button; + cursor: pointer; + padding: 10px 26px; + margin: 0.6rem 0; + border: 2px solid #2A2D34; + background-color: #2A2D34; + color: #FFF; + text-decoration: none; + display: inline-block; + border-radius: 4px; + font-weight: bold; + font-size: 16px; +} +.button:hover, +button:hover, +[type=button]:hover, +[type=reset]:hover, +[type=submit]:hover { + background-color: #414550; + border-color: #414550; + color: #FFF; +} +p .button, +p button, +p [type=button], +p [type=reset], +p [type=submit] { + margin: 0; +} + +header { + width: 100%; + background-color: #2A2D34; + padding: 16px; +} + +header .layout-wrapper { + position: relative; +} + +header .layout-wrapper * { + display: inline-block; + vertical-align: middle; +} + +nav { + right: 0; + vertial-align: middle; + display: inline-block; +} + +nav ul { + list-style: none; + margin: 0; + padding: 0; +} + +nav ul li { + display: inline; + color: #F8F8FF; + padding: 4px 8px; +} + +nav ul li a { + text-decoration: none; + color: #F8F8FF; + padding: 4px 8px; +} +nav ul li a:hover { + color: #FFF; +} + +nav ul li ul { + border-top: 16px solid transparent; + z-index: 30; +} + +nav ul > li:before { + content: ""; + position: absolute; +} + +.site-title { + color: #F8F8FF; + padding: 6px; + text-decoration: none; + font-weight: bold; + font-size: 16px; + vertial-align: middle; + display: inline-block; +} + +.logo { + fill: #F8F8FF; + width: 32px; + height: 32px; +} + +footer { + background-color: #2A2D34; + color: #FFF; +} + +.footer__link { + text-decoration: none; + color: #F8F8FF; +} +.footer__link:hover { + color: #06BEE1; +} + +.alert, .alert--alert, .alert--error, .alert--success, .alert--notification { + width: 100%; + padding: 12px; + border-radius: 6px; +} + +.alert--notification { + background-color: #06BEE1; +} + +.alert--success { + background-color: #35CE8D; +} + +.alert--error { + background-color: #AD2831; + color: #FFF; +} + +.alert--alert { + background-color: lightgoldenrodyellow; +} + +object * { + fill: #FFF; +} + +*, *:before, *:after { + -webkit-box-sizing: inherit; + -moz-box-sizing: inherit; + box-sizing: inherit; +} + +html { + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +html, body { + margin: 0; + height: 100%; +} + +body { + display: flex; + flex-direction: column; + font-family: system-ui, sans-serif; +} + +main { + flex: 1 0 auto; +} + +.layout-wrapper { + width: 100%; + max-width: 1240px; + padding: 0 20px; + margin: 0 auto; +} + +.banner { + margin: 0 auto; + width: 100%; + height: 200px; + background-color: #2A2D34; + color: #FFF; + margin-bottom: 12px; +} + +/*# sourceMappingURL=main.css.map */ diff --git a/css/main.css.map b/css/main.css.map new file mode 100644 index 0000000..8272fc0 --- /dev/null +++ b/css/main.css.map @@ -0,0 +1 @@ +{"version":3,"sourceRoot":"","sources":["form.scss","colours.scss","header.scss","variables.scss","footer.scss","alert.scss","main.scss"],"names":[],"mappings":";AAgCA;EA/BC;EAEA;EACA;EACA;EAEA,YCJO;EDKP;EACA;EACA,OCNO;EDOP;EACA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACC,cCZa;EDab,YCba;EDcb;EACA;;AAGD;EACC;;;AAOF;EAEI;;;AAIH;EAxCA;EAEA;EACA;EACA;EAEA,YCJO;EDKP;EACA;EACA,OCNO;EDOP;EACA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACC,cCZa;EDab,YCba;EDcb;EACA;;AAGD;EACC;;;AAqBF;AAAA;AAAA;AAAA;AAAA;EAKC;EACA;EAEA;EACG;EACA;EACA,kBC5DO;ED6DP,OC1DI;ED2DJ;EACA;EACA;EACA;EACA;;AAEA;AAAA;AAAA;AAAA;AAAA;EACI;EACA;EACA,OCpEA;;ADwEP;AAAA;AAAA;AAAA;AAAA;EACC;;;AE5EF;EACC;EACA,kBDFU;ECGV;;;AAED;EACC;;;AAED;EACC;EACA;;;AAGD;EAEC;EACA;EACA;;;AAED;EACC;EACA;EACA;;;AAED;EACC;EACA,ODzBa;EC0Bb;;;AAED;EACC;EACA,OD9Ba;EC+Bb;;AAEA;EACC,ODhCM;;;ACmCR;EACC;EACA,SCxCS;;;AD2CV;EACC;EACA;;;AAED;EACC,OD/Ca;ECgDb;EACA;EACA;EACA;EACA;EACA;;;AAED;EACC,MDxDa;ECyDb;EACA;;;AE3DD;EACC,kBHDU;EGEV,OHCO;;;AGCR;EACC;EACA,OHLa;;AGOb;EACC;;;ACTF;EACC;EACA;EACA;;;AAED;EAEC,kBJEc;;;AIAf;EAEC,kBJJS;;;AIMV;EAEC,kBJPO;EIQP,OJbO;;;AIeR;EAEC,kBJVO;;;AKHR;EACC,MLLO;;;AKOR;EACC;EACA;EACA;;;AAED;EACC;EACA;EACA;;;AAED;EACC;EACA;;;AAED;EACC;EACA;EACA;;;AAED;EACC;;;AAGD;EACC;EACA;EACA;EACA;;;AAED;EACC;EACA;EACA;EACA,kBL3CU;EK4CV,OLzCO;EK0CP","file":"main.css"} \ No newline at end of file diff --git a/css/main.scss b/css/main.scss new file mode 100644 index 0000000..8ea04ec --- /dev/null +++ b/css/main.scss @@ -0,0 +1,48 @@ +@import 'colours'; +@import 'variables'; +@import 'form'; +@import 'header'; +@import 'footer'; +@import 'alert'; + +object *{ + fill: $white; +} +*, *:before, *:after{ + -webkit-box-sizing: inherit; + -moz-box-sizing: inherit; + box-sizing: inherit; +} +html{ + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} +html, body{ + margin: 0; + height: 100%; +} +body{ + display: flex; + flex-direction: column; + font-family: system-ui, sans-serif; +} +main{ + flex: 1 0 auto; +} + +.layout-wrapper{ + width: 100%; + max-width: 1240px; + padding: 0 20px; + margin: 0 auto; +} +.banner{ + margin: 0 auto; + width: 100%; + height: 200px; + background-color: $gunmetal; + color: $white; + margin-bottom: 12px; +} + diff --git a/css/variables.scss b/css/variables.scss new file mode 100644 index 0000000..c0aeab7 --- /dev/null +++ b/css/variables.scss @@ -0,0 +1,6 @@ +$zi-high: 30; +$zi-med: 20; +$zi-low: 10; +$zi-ground: 0; +$zi-below: -1; + diff --git a/elo.php b/elo.php new file mode 100644 index 0000000..b15ab01 --- /dev/null +++ b/elo.php @@ -0,0 +1,59 @@ + $dbTeam['name'], + 'players' => [], + 'playerRating' => 0, + 'expected' => NULL, + 'score' => NULL, + ]; + $teamPlayers = 0; + + $players = getTeamPlayers($conn, $dbTeam['id']); + foreach($players as $player){ + $team['players'][] = [ + 'ign' => $player['ign'], + 'rating' => $player['rating'], + 'kfactor' => 40, + ]; + $team['playerRating'] += $player['rating']; + $teamPlayers++; + } + + $team['playerRating'] = $team['playerRating']/$teamPlayers; + $teams[] = $team; + +} + +//die("Db stuff only"); + +// Expected result of the match +// 1/(1+10^((OpponentRating - Your rating)/400)) +// this is for bo1 +// TODO: +$teams[0]['expected'] = 1 / ( 1 + ( pow( 10 , ( $teams[1]['playerRating'] - $teams[0]['playerRating'] ) / 400 ) ) ); +$teams[1]['expected'] = 1 / ( 1 + ( pow( 10 , ( $teams[0]['playerRating'] - $teams[1]['playerRating'] ) / 400 ) ) ); + +$teams[0]['score'] = 1; +$teams[1]['score'] = 0; + +$t = 1; +$i = 1; + +?> + diff --git a/images/injected.jpg b/images/injected.jpg new file mode 100755 index 0000000..e549b23 Binary files /dev/null and b/images/injected.jpg differ diff --git a/images/mite.svg b/images/mite.svg new file mode 100755 index 0000000..b628cbf --- /dev/null +++ b/images/mite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/svgrepo b/images/svgrepo new file mode 100644 index 0000000..8cb6f71 --- /dev/null +++ b/images/svgrepo @@ -0,0 +1 @@ +mite is from svgrepo.com diff --git a/include/db_connect.inc.php b/include/db_connect.inc.php new file mode 100644 index 0000000..022cd01 --- /dev/null +++ b/include/db_connect.inc.php @@ -0,0 +1,20 @@ + "localhost", + 'username' => "admin", + 'password' => "password", + 'database' => "tournaments" +]; + +// Create connection +$conn = new mysqli($dbVars['servername'], $dbVars['username'], $dbVars['password'], $dbVars['database']); + +// Check connection +if ($conn->connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +//echo "Connected successfully"; + +?> diff --git a/index.php b/index.php new file mode 100644 index 0000000..bdcffd2 --- /dev/null +++ b/index.php @@ -0,0 +1,51 @@ + 'Tournamite', + 'description' => 'Index description', + 'keywords' => 'tournamite, tournament, tourney' + ]; + require_once('partial/head.php'); +?> + + +
+