@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | <source src="/musicfiles/' . $filename . '"> |
| 70 | 70 | </audio>'; |
| 71 | 71 | } else if($type == "image") { |
| 72 | - echo "<img style='max-width: 100%;' src='/images/" . $filename . "'>"; |
|
| 72 | + echo "<img style='max-width: 100%;' src='/images/" . $filename . "'>"; |
|
| 73 | 73 | } else if($type == "midi") { |
| 74 | 74 | echo "Note: It may take a few seconds for the MIDI to load.<br>"; |
| 75 | 75 | echo "<a href='#' onClick=\"MIDIjs.play('/midis/" . $filename . "');\">Play " . $title . "</a>"; |
@@ -202,9 +202,9 @@ discard block |
||
| 202 | 202 | <script type="text/javascript" src="//cdn.jsdelivr.net/gh/deskjet/chiptune2.js@master/chiptune2.js"></script>'; |
| 203 | 203 | echo '<a class="song" data-modurl="/midis/' . $filename . '" href="#">Play ' . $title . '</a>'; |
| 204 | 204 | } else if($type == "news" || $type == "review") { |
| 205 | - //do nothing |
|
| 205 | + //do nothing |
|
| 206 | 206 | } else if($type == "video") { |
| 207 | - echo ' <video width="640" height="400" controls> |
|
| 207 | + echo ' <video width="640" height="400" controls> |
|
| 208 | 208 | <source src="/videos/' . $filename . '" type="video/mp4"> |
| 209 | 209 | </video> '; |
| 210 | 210 | } else { |
@@ -12,7 +12,9 @@ |
||
| 12 | 12 | $stmt->bind_param("i", $_GET['id']); |
| 13 | 13 | $stmt->execute(); |
| 14 | 14 | $result = $stmt->get_result(); |
| 15 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 15 | + if($result->num_rows === 0) { |
|
| 16 | + echo('There are no users.'); |
|
| 17 | + } |
|
| 16 | 18 | while($row = $result->fetch_assoc()) { |
| 17 | 19 | $author = $row['author']; |
| 18 | 20 | $id = $row['id']; |
@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | require(__DIR__ . "/func/func.php"); |
| 8 | 8 | require(__DIR__ . "/func/conn.php"); |
| 9 | 9 | |
| 10 | - if(isset($_GET['id'])) { |
|
| 10 | + if (isset($_GET['id'])) { |
|
| 11 | 11 | $stmt = $conn->prepare("SELECT * FROM files WHERE id = ?"); |
| 12 | 12 | $stmt->bind_param("i", $_GET['id']); |
| 13 | 13 | $stmt->execute(); |
| 14 | 14 | $result = $stmt->get_result(); |
| 15 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 16 | - while($row = $result->fetch_assoc()) { |
|
| 15 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 16 | + while ($row = $result->fetch_assoc()) { |
|
| 17 | 17 | $author = $row['author']; |
| 18 | 18 | $id = $row['id']; |
| 19 | 19 | $date = $row['date']; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $status = $row['status']; |
| 24 | 24 | $filename = $row['filename']; |
| 25 | 25 | |
| 26 | - if($status != "y") { |
|
| 26 | + if ($status != "y") { |
|
| 27 | 27 | die("Item is not approved yet."); |
| 28 | 28 | } |
| 29 | 29 | } |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | <div class="container"> |
| 39 | 39 | <?php |
| 40 | - if($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 40 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 41 | 41 | { |
| 42 | - if(!isset($_SESSION['user'])){ $error = "you are not logged in"; goto skipcomment; } |
|
| 43 | - if(!$_POST['comment']){ $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 44 | - if(strlen($_POST['comment']) > 500){ $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 45 | - if(!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; } |
|
| 46 | - if(!validateCaptcha(CAPTCHA_PRIVATEKEY, $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; } |
|
| 42 | + if (!isset($_SESSION['user'])) { $error = "you are not logged in"; goto skipcomment; } |
|
| 43 | + if (!$_POST['comment']) { $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 44 | + if (strlen($_POST['comment']) > 500) { $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 45 | + if (!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; } |
|
| 46 | + if (!validateCaptcha(CAPTCHA_PRIVATEKEY, $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; } |
|
| 47 | 47 | |
| 48 | 48 | $stmt = $conn->prepare("INSERT INTO `gamecomments` (toid, author, text, date) VALUES (?, ?, ?, now())"); |
| 49 | 49 | $stmt->bind_param("sss", $_GET['id'], $_SESSION['user'], $text); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $stmt->close(); |
| 53 | 53 | } |
| 54 | 54 | skipcomment: |
| 55 | - if(isset($error)) { |
|
| 55 | + if (isset($error)) { |
|
| 56 | 56 | echo "<span style='color: red;'><small>" . $error . "</small></span><br>"; |
| 57 | 57 | } |
| 58 | 58 | |
@@ -64,17 +64,17 @@ discard block |
||
| 64 | 64 | <br><br>" . $extrainfo . "</small><hr>"; |
| 65 | 65 | ?> |
| 66 | 66 | <?php |
| 67 | - if($type == "song") { |
|
| 67 | + if ($type == "song") { |
|
| 68 | 68 | echo '<audio controls> |
| 69 | 69 | <source src="/musicfiles/' . $filename . '"> |
| 70 | 70 | </audio>'; |
| 71 | - } else if($type == "image") { |
|
| 71 | + } else if ($type == "image") { |
|
| 72 | 72 | echo "<img style='max-width: 100%;' src='/images/" . $filename . "'>"; |
| 73 | - } else if($type == "midi") { |
|
| 73 | + } else if ($type == "midi") { |
|
| 74 | 74 | echo "Note: It may take a few seconds for the MIDI to load.<br>"; |
| 75 | 75 | echo "<a href='#' onClick=\"MIDIjs.play('/midis/" . $filename . "');\">Play " . $title . "</a>"; |
| 76 | 76 | echo "<br><a href='#' onClick='MIDIjs.stop();'>Stop MIDI Playback</a>"; |
| 77 | - } else if($type == "chiptune") { |
|
| 77 | + } else if ($type == "chiptune") { |
|
| 78 | 78 | //the way i did this absolutely sucks and im |
| 79 | 79 | echo '<script type="text/javascript"> |
| 80 | 80 | window["libopenmpt"] = {}; |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | <script type="text/javascript" src="//cdn.jsdelivr.net/gh/deskjet/chiptune2.js@master/libopenmpt.js"></script> |
| 202 | 202 | <script type="text/javascript" src="//cdn.jsdelivr.net/gh/deskjet/chiptune2.js@master/chiptune2.js"></script>'; |
| 203 | 203 | echo '<a class="song" data-modurl="/midis/' . $filename . '" href="#">Play ' . $title . '</a>'; |
| 204 | - } else if($type == "news" || $type == "review") { |
|
| 204 | + } else if ($type == "news" || $type == "review") { |
|
| 205 | 205 | //do nothing |
| 206 | - } else if($type == "video") { |
|
| 206 | + } else if ($type == "video") { |
|
| 207 | 207 | echo ' <video width="640" height="400" controls> |
| 208 | 208 | <source src="/videos/' . $filename . '" type="video/mp4"> |
| 209 | 209 | </video> '; |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | $result = $stmt->get_result(); |
| 224 | 224 | ?> |
| 225 | 225 | <div class="commentsList"> |
| 226 | - <?php while($row = $result->fetch_assoc()) { ?> |
|
| 226 | + <?php while ($row = $result->fetch_assoc()) { ?> |
|
| 227 | 227 | <div class='commentRight' style='display: grid; grid-template-columns: auto 85%; padding:5px;'> |
| 228 | 228 | <div> |
| 229 | 229 | <a style='float: left;' href='/?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a> |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | </div> |
| 233 | 233 | <div style="word-wrap: break-word;"> |
| 234 | 234 | <small><?php echo $row['date']; ?></small> |
| 235 | - <?php echo validateMarkdown($row['text']);?> |
|
| 235 | + <?php echo validateMarkdown($row['text']); ?> |
|
| 236 | 236 | </div> |
| 237 | 237 | </div> |
| 238 | 238 | <?php } ?> |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 16 | - if(isset($_SESSION['user'])) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | + if (isset($_SESSION['user'])) { |
|
| 17 | 17 | $target_dir = __DIR__ . "/musicfiles/"; |
| 18 | 18 | $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); |
| 19 | 19 | $uploadOk = 1; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | echo 'file with the same name already exists<hr>'; |
| 24 | 24 | $uploadOk = 0; |
| 25 | 25 | } |
| 26 | - if($imageFileType != "ogg" && $imageFileType != "mp3") { |
|
| 26 | + if ($imageFileType != "ogg" && $imageFileType != "mp3") { |
|
| 27 | 27 | echo 'unsupported file type. must be ogg or mp3<hr>'; |
| 28 | 28 | $uploadOk = 0; |
| 29 | 29 | } |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 16 | - if(isset($_SESSION['user'])) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | + if (isset($_SESSION['user'])) { |
|
| 17 | 17 | $target_dir = __DIR__ . "/gamefiles/"; |
| 18 | 18 | $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); |
| 19 | 19 | $uploadOk = 1; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | echo 'file with the same name already exists<hr>'; |
| 24 | 24 | $uploadOk = 0; |
| 25 | 25 | } |
| 26 | - if($imageFileType != "swf") { |
|
| 26 | + if ($imageFileType != "swf") { |
|
| 27 | 27 | echo 'unsupported file type. must be swf<hr>'; |
| 28 | 28 | $uploadOk = 0; |
| 29 | 29 | } |
@@ -2,13 +2,13 @@ |
||
| 2 | 2 | require(__DIR__ . "/func/func.php"); |
| 3 | 3 | require(__DIR__ . "/func/conn.php"); |
| 4 | 4 | |
| 5 | -if(isset($_SESSION['user'])) { |
|
| 6 | - if(isset($_GET['id'])) { |
|
| 5 | +if (isset($_SESSION['user'])) { |
|
| 6 | + if (isset($_GET['id'])) { |
|
| 7 | 7 | $stmt = $conn->prepare("SELECT * FROM `groups` WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |
| 10 | 10 | $result = $stmt->get_result(); |
| 11 | - if($result->num_rows === 0) { |
|
| 11 | + if ($result->num_rows === 0) { |
|
| 12 | 12 | die("Group doesn't exist"); |
| 13 | 13 | } |
| 14 | 14 | $stmt->close(); |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | <?php require(__DIR__ . "/important/header.php"); ?> |
| 22 | 22 | <div class="container"> |
| 23 | 23 | <h1>2-Factor Authentication</h1> |
| 24 | - 2FA status: <?php if ($otpstatus) {echo "enabled";} else {echo "disabled";}?><br> |
|
| 25 | - <?php if ($otpstatus) {echo "Backup code: " . $result->fetch_assoc()['otpbackupcode'];} ?><br><br> |
|
| 24 | + 2FA status: <?php if ($otpstatus) {echo "enabled"; } else {echo "disabled"; }?><br> |
|
| 25 | + <?php if ($otpstatus) {echo "Backup code: " . $result->fetch_assoc()['otpbackupcode']; } ?><br><br> |
|
| 26 | 26 | <button> |
| 27 | 27 | <?php if ($otpstatus) { ?> |
| 28 | 28 | <a href="/disable2fa">Disable 2FA</a> |
@@ -12,8 +12,8 @@ discard block |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 16 | - if(isset($_SESSION['user'])) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | + if (isset($_SESSION['user'])) { |
|
| 17 | 17 | $target_dir = __DIR__ . "/videos/"; |
| 18 | 18 | $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); |
| 19 | 19 | $uploadOk = 1; |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | echo 'file with the same name already exists<hr>'; |
| 24 | 24 | $uploadOk = 0; |
| 25 | 25 | } |
| 26 | - if($imageFileType != "mp4") { |
|
| 26 | + if ($imageFileType != "mp4") { |
|
| 27 | 27 | echo 'unsupported file type. must be swf<hr>'; |
| 28 | 28 | $uploadOk = 0; |
| 29 | 29 | } |
@@ -12,35 +12,35 @@ discard block |
||
| 12 | 12 | <link rel="stylesheet" href="/css/header.css"> |
| 13 | 13 | </head> |
| 14 | 14 | <body> |
| 15 | - <?php require(__DIR__ . "/important/header.php"); ?> |
|
| 15 | + <?php require(__DIR__ . "/important/header.php"); ?> |
|
| 16 | 16 | <center><h1 style="display: inline-block;">4Grounds - Register</h1><br> |
| 17 | 17 | <?php |
| 18 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) |
|
| 18 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) |
|
| 19 | 19 | { |
| 20 | 20 | $email = htmlspecialchars(@$_POST['email']); |
| 21 | 21 | $username = htmlspecialchars(@$_POST['username']); |
| 22 | 22 | $password = @$_POST['password']; |
| 23 | 23 | $passwordhash = password_hash(@$password, PASSWORD_DEFAULT); |
| 24 | 24 | |
| 25 | - if($_POST['password'] !== $_POST['confirm']){ $error = "password and confirmation password do not match"; goto skip; } |
|
| 25 | + if ($_POST['password'] !== $_POST['confirm']) { $error = "password and confirmation password do not match"; goto skip; } |
|
| 26 | 26 | |
| 27 | - if(strlen($username) > 21) { $error = "your username must be shorter than 21 characters"; goto skip; } |
|
| 28 | - if(strlen($password) < 8) { $error = "your password must be at least 8 characters long"; goto skip; } |
|
| 29 | - if(!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $password)) { $error = "please include both letters and numbers in your password"; goto skip; } |
|
| 30 | - if(!isset($_POST['g-recaptcha-response'])){ $error = "captcha validation failed"; goto skip; } |
|
| 31 | - if(!validateCaptcha(CAPTCHA_PRIVATEKEY, $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 27 | + if (strlen($username) > 21) { $error = "your username must be shorter than 21 characters"; goto skip; } |
|
| 28 | + if (strlen($password) < 8) { $error = "your password must be at least 8 characters long"; goto skip; } |
|
| 29 | + if (!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $password)) { $error = "please include both letters and numbers in your password"; goto skip; } |
|
| 30 | + if (!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 31 | + if (!validateCaptcha(CAPTCHA_PRIVATEKEY, $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 32 | 32 | |
| 33 | 33 | $stmt = $conn->prepare("SELECT username FROM users WHERE username = ?"); |
| 34 | 34 | $stmt->bind_param("s", $username); |
| 35 | 35 | $stmt->execute(); |
| 36 | 36 | $result = $stmt->get_result(); |
| 37 | - if($result->num_rows) { $error = "there's already a user with that same name!"; goto skip; } |
|
| 37 | + if ($result->num_rows) { $error = "there's already a user with that same name!"; goto skip; } |
|
| 38 | 38 | |
| 39 | 39 | $stmt = $conn->prepare("SELECT email FROM users WHERE email = ?"); |
| 40 | 40 | $stmt->bind_param("s", $email); |
| 41 | 41 | $stmt->execute(); |
| 42 | 42 | $result = $stmt->get_result(); |
| 43 | - if($result->num_rows) { $error = "there's already a user with that same email!"; goto skip; } |
|
| 43 | + if ($result->num_rows) { $error = "there's already a user with that same email!"; goto skip; } |
|
| 44 | 44 | |
| 45 | 45 | //TODO: add cloudflare ip thing |
| 46 | 46 | $stmt = $conn->prepare("INSERT INTO `users` (`username`, `email`, `password`) VALUES (?, ?, ?)"); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | skip: |
| 62 | 62 | |
| 63 | - if(isset($error)) { echo "<small style='color:red'>".$error."</small>"; } ?> |
|
| 63 | + if (isset($error)) { echo "<small style='color:red'>" . $error . "</small>"; } ?> |
|
| 64 | 64 | <form method="post"> |
| 65 | 65 | <input required placeholder="Username" type="text" name="username"><br> |
| 66 | 66 | <input required placeholder="E-Mail" type="email" name="email"><br><br> |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | require(__DIR__ . "/func/func.php"); |
| 9 | 9 | require(__DIR__ . "/func/conn.php"); |
| 10 | 10 | $featured = array(1, 3, 12); |
| 11 | - $newlines = array("<br>", " <br>", "<br>" , " <br> "); |
|
| 11 | + $newlines = array("<br>", " <br>", "<br>", " <br> "); |
|
| 12 | 12 | ?> |
| 13 | 13 | <title>4Grounds - Hub</title> |
| 14 | 14 | </head> |
@@ -17,27 +17,27 @@ discard block |
||
| 17 | 17 | <div class="container"><br> |
| 18 | 18 | <h1>Search results for type '<?php echo htmlspecialchars($_GET['type']); ?>'</h1> |
| 19 | 19 | <?php |
| 20 | - if(isset($_GET['type'])) { |
|
| 20 | + if (isset($_GET['type'])) { |
|
| 21 | 21 | $stmt = $conn->prepare("SELECT * FROM `files` WHERE type = ? AND status = 'y' ORDER BY id DESC"); |
| 22 | 22 | $stmt->bind_param("s", $_GET['type']); |
| 23 | 23 | $stmt->execute(); |
| 24 | 24 | $result = $stmt->get_result(); |
| 25 | 25 | |
| 26 | - while($row = $result->fetch_assoc()) { |
|
| 27 | - if($row['type'] == "song") { |
|
| 26 | + while ($row = $result->fetch_assoc()) { |
|
| 27 | + if ($row['type'] == "song") { |
|
| 28 | 28 | echo '<b><a href="/view?id=' . $row['id'] . '">' . htmlspecialchars($row['title']) . '</b></a> <span style="float:right;"><small>Uploader: <b>' . $row['author'] . '</b></small></span><br> |
| 29 | 29 | ' . $row['extrainfo'] . '<br> |
| 30 | 30 | <audio controls> |
| 31 | 31 | <source src="/musicfiles/' . $row['filename'] . '"> |
| 32 | 32 | </audio><hr>'; |
| 33 | - } else if($row['type'] == "image") { |
|
| 33 | + } else if ($row['type'] == "image") { |
|
| 34 | 34 | //im sorry for this abomination |
| 35 | 35 | echo "<div style='display: inline-block;' class='notegray'> |
| 36 | 36 | <a href='/view?id=" . $row['id'] . "'><img style='width: 10em;height: 10em;' src='images/" . $row['filename'] . "'> |
| 37 | 37 | <br><center><b>" . htmlspecialchars($row['title']) . "</b><br><span style='color: gray;'>By " . $row['author'] . "</span></center> |
| 38 | 38 | </a> |
| 39 | 39 | </div> "; |
| 40 | - } else if($row['type'] == "news" || $row['type'] == "review") { |
|
| 40 | + } else if ($row['type'] == "news" || $row['type'] == "review") { |
|
| 41 | 41 | echo "<small> |
| 42 | 42 | <img style='position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 43 | 43 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'>[" . $row['agerating'] . "] <i>" . $row['title'] . "</a></i></span><br> |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } else { |
| 48 | 48 | echo "<b><a href='/view?id=" . $row['id'] . "'>" . htmlspecialchars($row['title']) . " by " . $row['author'] . " |
| 49 | 49 | </a><small><span style='float:right;'>[" . $row['date'] . "]</small></span>"; |
| 50 | - if(in_array($row['id'], $featured)) { |
|
| 50 | + if (in_array($row['id'], $featured)) { |
|
| 51 | 51 | echo "<span style='float:right; color: gold;margin-right: 10px;'>Featured!</span> "; |
| 52 | 52 | } |
| 53 | 53 | echo "</b><br>" . $row['extrainfo'] . "<br><hr>"; |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require("important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 16 | - if(isset($_SESSION['user'])) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | + if (isset($_SESSION['user'])) { |
|
| 17 | 17 | $stmt = $conn->prepare("INSERT INTO `groups` (title, description, author) VALUES (?, ?, ?)"); |
| 18 | 18 | $stmt->bind_param("sss", $name, $text, $_SESSION['user']); |
| 19 | 19 | $text = htmlspecialchars($_POST['description']); |