@@ -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']); |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | require(__DIR__ . "/func/func.php"); |
| 9 | 9 | require(__DIR__ . "/func/conn.php"); |
| 10 | 10 | |
| 11 | - if(isset($_GET['id'])) { |
|
| 11 | + if (isset($_GET['id'])) { |
|
| 12 | 12 | $stmt = $conn->prepare("SELECT * FROM users WHERE id = ?"); |
| 13 | 13 | $stmt->bind_param("i", $_GET['id']); |
| 14 | 14 | $stmt->execute(); |
| 15 | 15 | $result = $stmt->get_result(); |
| 16 | - if($result->num_rows !== 0){ // echo('There are no users.'); // please just refuse to give a user if this is the case |
|
| 17 | - while($row = $result->fetch_assoc()) { // you dont need to use a loop if its only ever gonna return 1 or 0 |
|
| 16 | + if ($result->num_rows !== 0) { // echo('There are no users.'); // please just refuse to give a user if this is the case |
|
| 17 | + while ($row = $result->fetch_assoc()) { // you dont need to use a loop if its only ever gonna return 1 or 0 |
|
| 18 | 18 | $username = $row['username']; // you dont actually need all of these variables oh my god just use an array |
| 19 | 19 | $id = $row['id']; |
| 20 | 20 | $date = $row['date']; |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | $stmt->bind_param("i", $currentgroup); |
| 39 | 39 | $stmt->execute(); |
| 40 | 40 | $result = $stmt->get_result(); |
| 41 | - if($result->num_rows !== 0){ //echo('There are no users.'); // why again |
|
| 42 | - while($row = $result->fetch_assoc()) { |
|
| 41 | + if ($result->num_rows !== 0) { //echo('There are no users.'); // why again |
|
| 42 | + while ($row = $result->fetch_assoc()) { |
|
| 43 | 43 | $grouptitle = $row['title']; |
| 44 | 44 | } |
| 45 | - }else{ |
|
| 45 | + } else { |
|
| 46 | 46 | $grouptitle = "none"; |
| 47 | 47 | } |
| 48 | 48 | $stmt->close(); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $result = $stmt->get_result(); |
| 54 | 54 | |
| 55 | 55 | $comments = 0; |
| 56 | - while($row = $result->fetch_assoc()) { |
|
| 56 | + while ($row = $result->fetch_assoc()) { |
|
| 57 | 57 | $comments++; |
| 58 | 58 | } |
| 59 | 59 | $stmt->close(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $result = $stmt->get_result(); |
| 65 | 65 | |
| 66 | 66 | $profilecomments = 0; |
| 67 | - while($row = $result->fetch_assoc()) { |
|
| 67 | + while ($row = $result->fetch_assoc()) { |
|
| 68 | 68 | $profilecomments++; |
| 69 | 69 | } |
| 70 | 70 | $stmt->close(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $result = $stmt->get_result(); |
| 76 | 76 | |
| 77 | 77 | $filesuploaded = 0; |
| 78 | - while($row = $result->fetch_assoc()) { |
|
| 78 | + while ($row = $result->fetch_assoc()) { |
|
| 79 | 79 | $filesuploaded++; |
| 80 | 80 | } |
| 81 | 81 | $stmt->close(); |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | <div class="container"> |
| 96 | 96 | <br> |
| 97 | 97 | <?php |
| 98 | - if($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 98 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 99 | 99 | { |
| 100 | - if(!isset($_SESSION['user'])){ $error = "you are not logged in"; goto skipcomment; } |
|
| 101 | - if(!$_POST['comment']){ $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 102 | - if(strlen($_POST['comment']) > 500){ $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 100 | + if (!isset($_SESSION['user'])) { $error = "you are not logged in"; goto skipcomment; } |
|
| 101 | + if (!$_POST['comment']) { $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 102 | + if (strlen($_POST['comment']) > 500) { $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 103 | 103 | |
| 104 | 104 | $stmt = $conn->prepare("INSERT INTO `comments` (toid, author, text) VALUES (?, ?, ?)"); |
| 105 | 105 | $stmt->bind_param("sss", $_GET['id'], $_SESSION['user'], $text); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | skipcomment: |
| 113 | 113 | |
| 114 | - if(isset($id)) {?> |
|
| 114 | + if (isset($id)) {?> |
|
| 115 | 115 | <div id="groundtext"><center><h1><?php echo $username; ?>'s Ground</h1></center></div> |
| 116 | 116 | <div class="leftHalf"> |
| 117 | 117 | <div class="notegray"> |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | </center> |
| 122 | 122 | <hr style="border-top: 1px dashed gray;"> |
| 123 | 123 | <div id="userinfo" style="padding-left: 20px;"> |
| 124 | - <span style="color: gold;">Rank:</span> <?php echo $rank;?><br> |
|
| 125 | - <span style="color: gold;">ID:</span> <?php echo $id;?><br> |
|
| 126 | - <span style="color: gold;">Other Comments:</span> <?php echo $comments;?><br> |
|
| 127 | - <span style="color: gold;">Profile Comments:</span> <?php echo $profilecomments;?><br> |
|
| 128 | - <span style="color: gold;">Current Group:</span> <?php echo $grouptitle;?><br> |
|
| 129 | - <span style="color: gold;">Files Uploaded:</span> <?php echo $filesuploaded;?> |
|
| 124 | + <span style="color: gold;">Rank:</span> <?php echo $rank; ?><br> |
|
| 125 | + <span style="color: gold;">ID:</span> <?php echo $id; ?><br> |
|
| 126 | + <span style="color: gold;">Other Comments:</span> <?php echo $comments; ?><br> |
|
| 127 | + <span style="color: gold;">Profile Comments:</span> <?php echo $profilecomments; ?><br> |
|
| 128 | + <span style="color: gold;">Current Group:</span> <?php echo $grouptitle; ?><br> |
|
| 129 | + <span style="color: gold;">Files Uploaded:</span> <?php echo $filesuploaded; ?> |
|
| 130 | 130 | </div><br> |
| 131 | 131 | <?php if (!isset($_GET["ed"])) { ?> |
| 132 | 132 | <audio autoplay controls> |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | </div> |
| 137 | 137 | <br> |
| 138 | 138 | <div class="notegray"> |
| 139 | - <?php if(isset($error)) { echo "<small style='color:red'>".$error."</small>"; } ?> |
|
| 139 | + <?php if (isset($error)) { echo "<small style='color:red'>" . $error . "</small>"; } ?> |
|
| 140 | 140 | <h2>Comment</h2> |
| 141 | 141 | <form method="post" enctype="multipart/form-data"> |
| 142 | 142 | <textarea required cols="33" placeholder="Comment" name="comment"></textarea><br> |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | <div id="badges" class="notegray"> |
| 156 | 156 | <h1>Badges</h1> |
| 157 | 157 | <?php |
| 158 | - foreach($badges as $badge) { |
|
| 159 | - if($badge == "good") { |
|
| 158 | + foreach ($badges as $badge) { |
|
| 159 | + if ($badge == "good") { |
|
| 160 | 160 | echo "<img width='70px;' height='70px;' src='https://cdn.discordapp.com/attachments/740680780740821105/740776214523936808/340juojg3h.png'>"; |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | $stmt->bind_param("s", $username); |
| 169 | 169 | $stmt->execute(); |
| 170 | 170 | $result = $stmt->get_result(); |
| 171 | - if($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 171 | + if ($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 172 | 172 | |
| 173 | - while($row = $result->fetch_assoc()) { |
|
| 174 | - echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [' , $row['type'] . ']</a><br>'; |
|
| 173 | + while ($row = $result->fetch_assoc()) { |
|
| 174 | + echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [', $row['type'] . ']</a><br>'; |
|
| 175 | 175 | }?> |
| 176 | 176 | </div><br> |
| 177 | 177 | <div id="bio" class="notegray"> |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $stmt->execute(); |
| 186 | 186 | $result = $stmt->get_result(); |
| 187 | 187 | |
| 188 | - while($row = $result->fetch_assoc()) { ?> |
|
| 188 | + while ($row = $result->fetch_assoc()) { ?> |
|
| 189 | 189 | <div class='commentRight' style='display: grid; grid-template-columns: 75% auto; padding:5px;'> |
| 190 | 190 | <div style="word-wrap: break-word;"> |
| 191 | 191 | <small><?php echo $row['date']; ?></small> |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | <a href="/media">Featured</a><br> |
| 221 | 221 | <?php |
| 222 | - if(isset($_SESSION['user'])) { echo "<a href='/home'>Manage</a><br><a href='/files'>Files<a>"; } |
|
| 222 | + if (isset($_SESSION['user'])) { echo "<a href='/home'>Manage</a><br><a href='/files'>Files<a>"; } |
|
| 223 | 223 | ?> |
| 224 | 224 | </div> |
| 225 | 225 | <br> |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='review' AND status='y' ORDER BY RAND() LIMIT 1"); |
| 230 | 230 | $stmt->execute(); |
| 231 | 231 | $result = $stmt->get_result(); |
| 232 | - while($row = $result->fetch_assoc()) { |
|
| 232 | + while ($row = $result->fetch_assoc()) { |
|
| 233 | 233 | echo "<br><img style='height: 5em;position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 234 | 234 | <small> |
| 235 | 235 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>[" . $row['agerating'] . "] " . $row['title'] . "</a></i></span><br> |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='news' AND status='y' ORDER BY RAND() LIMIT 1"); |
| 246 | 246 | $stmt->execute(); |
| 247 | 247 | $result = $stmt->get_result(); |
| 248 | - while($row = $result->fetch_assoc()) { |
|
| 248 | + while ($row = $result->fetch_assoc()) { |
|
| 249 | 249 | echo "<br><img style='height: 5em;position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 250 | 250 | <small> |
| 251 | 251 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'>[" . $row['agerating'] . "] <i>" . $row['title'] . "</a></i></span><br> |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC"); |
| 262 | 262 | $stmt->execute(); |
| 263 | 263 | $result = $stmt->get_result(); |
| 264 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 265 | - while($row = $result->fetch_assoc()) { |
|
| 264 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 265 | + while ($row = $result->fetch_assoc()) { |
|
| 266 | 266 | $id = 1; |
| 267 | 267 | echo "<div class='item" . $id . "'><img style='height: 8em;width: 8em;' src='/pfp/" . getPFP($row['username'], $conn) . "'><br><a href='/?id=" . $row['id'] . "'>" . $row['username'] . "</a></div>"; |
| 268 | 268 | $id = $id + 1; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='image' AND status='y' ORDER BY RAND() LIMIT 6"); |
| 280 | 280 | $stmt->execute(); |
| 281 | 281 | $result = $stmt->get_result(); |
| 282 | - while($row = $result->fetch_assoc()) { |
|
| 282 | + while ($row = $result->fetch_assoc()) { |
|
| 283 | 283 | echo "<div style='display: inline-block;' class='notegray'> |
| 284 | 284 | <a href='/view?id=" . $row['id'] . "'><img style='width: 7.5em;height: 7.5em;' src='/images/" . $row['filename'] . "'> |
| 285 | 285 | <br><center><b>" . htmlspecialchars($row['title']) . "</b><br><span style='color: gray;'>By " . $row['author'] . "</span></center> |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | while($row = $result->fetch_assoc()) { |
| 43 | 43 | $grouptitle = $row['title']; |
| 44 | 44 | } |
| 45 | - }else{ |
|
| 45 | + } else{ |
|
| 46 | 46 | $grouptitle = "none"; |
| 47 | 47 | } |
| 48 | 48 | $stmt->close(); |
@@ -168,7 +168,9 @@ discard block |
||
| 168 | 168 | $stmt->bind_param("s", $username); |
| 169 | 169 | $stmt->execute(); |
| 170 | 170 | $result = $stmt->get_result(); |
| 171 | - if($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 171 | + if($result->num_rows > 0) { |
|
| 172 | + echo('<h1>Files</h1>'); |
|
| 173 | + } |
|
| 172 | 174 | |
| 173 | 175 | while($row = $result->fetch_assoc()) { |
| 174 | 176 | echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [' , $row['type'] . ']</a><br>'; |
@@ -261,7 +263,9 @@ discard block |
||
| 261 | 263 | $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC"); |
| 262 | 264 | $stmt->execute(); |
| 263 | 265 | $result = $stmt->get_result(); |
| 264 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 266 | + if($result->num_rows === 0) { |
|
| 267 | + echo('There are no users.'); |
|
| 268 | + } |
|
| 265 | 269 | while($row = $result->fetch_assoc()) { |
| 266 | 270 | $id = 1; |
| 267 | 271 | echo "<div class='item" . $id . "'><img style='height: 8em;width: 8em;' src='/pfp/" . getPFP($row['username'], $conn) . "'><br><a href='/?id=" . $row['id'] . "'>" . $row['username'] . "</a></div>"; |
@@ -9,7 +9,9 @@ |
||
| 9 | 9 | $stmt->bind_param("s", $_SESSION['user']); |
| 10 | 10 | $stmt->execute(); |
| 11 | 11 | $result = $stmt->get_result(); |
| 12 | - if($result->num_rows === 0) header('Location: index.php'); |
|
| 12 | + if($result->num_rows === 0) { |
|
| 13 | + header('Location: index.php'); |
|
| 14 | + } |
|
| 13 | 15 | while($row = $result->fetch_assoc()) { |
| 14 | 16 | $username = $row['username']; |
| 15 | 17 | $id = $row['id']; |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | $stmt->bind_param("s", $_SESSION['user']); |
| 10 | 10 | $stmt->execute(); |
| 11 | 11 | $result = $stmt->get_result(); |
| 12 | - if($result->num_rows === 0) header('Location: index.php'); |
|
| 13 | - while($row = $result->fetch_assoc()) { |
|
| 12 | + if ($result->num_rows === 0) header('Location: index.php'); |
|
| 13 | + while ($row = $result->fetch_assoc()) { |
|
| 14 | 14 | $username = $row['username']; |
| 15 | 15 | $id = $row['id']; |
| 16 | 16 | $date = $row['date']; |
@@ -28,29 +28,29 @@ discard block |
||
| 28 | 28 | <body> |
| 29 | 29 | <?php require(__DIR__ . "/important/header.php"); |
| 30 | 30 | |
| 31 | - if(@$_POST['bioset']) { |
|
| 31 | + if (@$_POST['bioset']) { |
|
| 32 | 32 | $stmt = $conn->prepare("UPDATE users SET bio = ? WHERE `users`.`username` = ?;"); |
| 33 | 33 | $stmt->bind_param("ss", $text, $_SESSION['user']); |
| 34 | 34 | $text = $_POST['bio']; |
| 35 | 35 | $stmt->execute(); |
| 36 | 36 | $stmt->close(); |
| 37 | 37 | header("Location: home.php"); |
| 38 | - } else if(@$_POST['css']) { |
|
| 38 | + } else if (@$_POST['css']) { |
|
| 39 | 39 | $stmt = $conn->prepare("UPDATE users SET css = ? WHERE `users`.`username` = ?;"); |
| 40 | 40 | $stmt->bind_param("ss", $validatedcss, $_SESSION['user']); |
| 41 | 41 | $validatedcss = validateCSS($_POST['css']); |
| 42 | 42 | $stmt->execute(); |
| 43 | 43 | $stmt->close(); |
| 44 | 44 | header("Location: home.php"); |
| 45 | - } else if(@$_POST['submit']) { |
|
| 45 | + } else if (@$_POST['submit']) { |
|
| 46 | 46 | $target_dir = "pfp/"; |
| 47 | 47 | $target_file = basename($_FILES["fileToUpload"]["name"]); |
| 48 | 48 | $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); |
| 49 | 49 | $target_file = $target_dir . getID($_SESSION['user'], $conn) . "." . $imageFileType; |
| 50 | 50 | $uploadOk = 1; |
| 51 | - if(isset($_POST["submit"])) { |
|
| 51 | + if (isset($_POST["submit"])) { |
|
| 52 | 52 | $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); |
| 53 | - if($check !== false) { |
|
| 53 | + if ($check !== false) { |
|
| 54 | 54 | $uploadOk = 1; |
| 55 | 55 | } else { |
| 56 | 56 | $uploadOk = 0; |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | // echo 'file with the same name already exists<hr>'; |
| 61 | 61 | // $uploadOk = 0; |
| 62 | 62 | // } |
| 63 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 64 | - && $imageFileType != "gif" ) { |
|
| 63 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 64 | + && $imageFileType != "gif") { |
|
| 65 | 65 | echo 'unsupported file type. must be jpg, png, jpeg, or gif<hr>'; |
| 66 | 66 | $uploadOk = 0; |
| 67 | 67 | } |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | echo 'fatal error<hr>'; |
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | - } else if(@$_POST['photoset']) { |
|
| 80 | + } else if (@$_POST['photoset']) { |
|
| 81 | 81 | $uploadOk = true; |
| 82 | 82 | $target_dir = "music/"; |
| 83 | 83 | $target_file = basename($_FILES["fileToUpload"]["name"]); |
| 84 | 84 | $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); |
| 85 | 85 | $target_file = $target_dir . getID($_SESSION['user'], $conn) . "." . $imageFileType; |
| 86 | - if(isset($_POST["submit"])) { |
|
| 86 | + if (isset($_POST["submit"])) { |
|
| 87 | 87 | $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]); |
| 88 | - if($check !== false) { |
|
| 88 | + if ($check !== false) { |
|
| 89 | 89 | $uploadOk = true; |
| 90 | 90 | } else { |
| 91 | 91 | $uploadOk = false; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | // echo 'file with the same name already exists<hr>'; |
| 96 | 96 | // $uploadOk = false; |
| 97 | 97 | // } |
| 98 | - if($imageFileType != "ogg" && $imageFileType != "mp3") { |
|
| 98 | + if ($imageFileType != "ogg" && $imageFileType != "mp3") { |
|
| 99 | 99 | echo 'unsupported file type. must be mp3 or ogg<hr>'; |
| 100 | 100 | $uploadOk = false; |
| 101 | 101 | } |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | <button><a href="/2fa">Manage 2-Factor Authentication</a></button><br><br> |
| 129 | 129 | <b>Bio</b> |
| 130 | 130 | <form method="post" enctype="multipart/form-data"> |
| 131 | - <textarea required cols="58" placeholder="Bio" name="bio"><?php echo $bio;?></textarea><br> |
|
| 131 | + <textarea required cols="58" placeholder="Bio" name="bio"><?php echo $bio; ?></textarea><br> |
|
| 132 | 132 | <input name="bioset" type="submit" value="Set"> |
| 133 | 133 | <small>max limit: 500 characters | supports <a href="https://www.markdownguide.org/basic-syntax">Markdown</a></small> |
| 134 | 134 | </form><br> |
| 135 | 135 | <b>CSS</b> |
| 136 | 136 | <button onclick="loadpfwin()" id="prevbtn">Show Live CSS Preview</button> |
| 137 | 137 | <form method="post" enctype="multipart/form-data"> |
| 138 | - <textarea required rows="15" cols="58" placeholder="Your CSS" name="css" id="css_code"><?php echo $css;?></textarea><br> |
|
| 138 | + <textarea required rows="15" cols="58" placeholder="Your CSS" name="css" id="css_code"><?php echo $css; ?></textarea><br> |
|
| 139 | 139 | <input name="cssset" type="submit" value="Set"> <small>max limit: 5000 characters</small> |
| 140 | 140 | </form><br> |
| 141 | 141 | </div> |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - if(isset($_SESSION['user'])) { |
|
| 2 | + if (isset($_SESSION['user'])) { |
|
| 3 | 3 | $stmt = $conn->prepare("SELECT * FROM `users` WHERE username = ?"); |
| 4 | 4 | $stmt->bind_param("s", $_SESSION['user']); |
| 5 | 5 | $stmt->execute(); |
| 6 | 6 | $result = $stmt->get_result(); |
| 7 | 7 | |
| 8 | - if($result->num_rows == 0) echo('welcome to gamestop how may i help you'); |
|
| 8 | + if ($result->num_rows == 0) echo('welcome to gamestop how may i help you'); |
|
| 9 | 9 | } |
| 10 | 10 | ?> |
| 11 | 11 | |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | • <a href="/viewgroups">Groups</a> |
| 32 | 32 | |
| 33 | 33 | <span style="float:right;"> |
| 34 | - <?php if(isset($_SESSION['user'])) {?> |
|
| 34 | + <?php if (isset($_SESSION['user'])) {?> |
|
| 35 | 35 | Logged in as |
| 36 | - <a href='/?id=<?php echo(getID($_SESSION['user'], $conn));?>'> |
|
| 37 | - <?php echo($_SESSION['user']);?> |
|
| 36 | + <a href='/?id=<?php echo(getID($_SESSION['user'], $conn)); ?>'> |
|
| 37 | + <?php echo($_SESSION['user']); ?> |
|
| 38 | 38 | </a> |
| 39 | 39 | • <a href='/home'>Manage</a> |
| 40 | 40 | • <a href='/logout'>Logout</a> |
@@ -5,7 +5,9 @@ |
||
| 5 | 5 | $stmt->execute(); |
| 6 | 6 | $result = $stmt->get_result(); |
| 7 | 7 | |
| 8 | - if($result->num_rows == 0) echo('welcome to gamestop how may i help you'); |
|
| 8 | + if($result->num_rows == 0) { |
|
| 9 | + echo('welcome to gamestop how may i help you'); |
|
| 10 | + } |
|
| 9 | 11 | } |
| 10 | 12 | ?> |
| 11 | 13 | |
@@ -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__ . "/midis/"; |
| 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 != "mid") { |
|
| 26 | + if ($imageFileType != "mid") { |
|
| 27 | 27 | echo 'unsupported file type. must be .mid<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__ . "/images/"; |
| 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 != "gif" && $imageFileType != "png" && $imageFileType != "jpg" && $imageFileType != "jpeg") { |
|
| 26 | + if ($imageFileType != "gif" && $imageFileType != "png" && $imageFileType != "jpg" && $imageFileType != "jpeg") { |
|
| 27 | 27 | echo 'unsupported file type. must be .gif, .png, .jpg, or .jpeg<hr>'; |
| 28 | 28 | $uploadOk = 0; |
| 29 | 29 | } |
@@ -21,16 +21,16 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | <div class="container"> |
| 23 | 23 | <?php |
| 24 | - if($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 25 | - if(!isset($_SESSION['user'])) { |
|
| 24 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') { |
|
| 25 | + if (!isset($_SESSION['user'])) { |
|
| 26 | 26 | $error = "you are not logged in"; |
| 27 | 27 | goto skipcomment; |
| 28 | 28 | } |
| 29 | - if(!$_POST['comment']) { |
|
| 29 | + if (!$_POST['comment']) { |
|
| 30 | 30 | $error = "your comment cannot be blank"; |
| 31 | 31 | goto skipcomment; |
| 32 | 32 | } |
| 33 | - if(strlen($_POST['comment']) > 500) { |
|
| 33 | + if (strlen($_POST['comment']) > 500) { |
|
| 34 | 34 | $error = "your comment must be shorter than 500 characters"; |
| 35 | 35 | goto skipcomment; |
| 36 | 36 | } |
@@ -45,26 +45,26 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | skipcomment: |
| 47 | 47 | |
| 48 | - if(isset($_GET['id'])) { |
|
| 48 | + if (isset($_GET['id'])) { |
|
| 49 | 49 | $stmt = $conn->prepare("SELECT * FROM `groups` WHERE id = ?"); |
| 50 | 50 | $stmt->bind_param("i", $_GET['id']); |
| 51 | 51 | $stmt->execute(); |
| 52 | 52 | $result = $stmt->get_result(); |
| 53 | - if($result->num_rows === 0) echo('Group doesnt exist.'); |
|
| 54 | - while($row = $result->fetch_assoc()) { |
|
| 53 | + if ($result->num_rows === 0) echo('Group doesnt exist.'); |
|
| 54 | + while ($row = $result->fetch_assoc()) { |
|
| 55 | 55 | $id = $row['id']; |
| 56 | 56 | ?> |
| 57 | 57 | <img style='border: 1px solid white; width: 5em;' |
| 58 | - src='/pfp/<?php echo getPFP($row["author"], $conn);?>'> |
|
| 58 | + src='/pfp/<?php echo getPFP($row["author"], $conn); ?>'> |
|
| 59 | 59 | <span style='float: right;text-align: right;'> |
| 60 | - <a href='/viewgroup?id=<?php echo $row["id"];?>' style='color: gold;font-size:1.5em'> |
|
| 61 | - <?php echo $row['title'];?> |
|
| 60 | + <a href='/viewgroup?id=<?php echo $row["id"]; ?>' style='color: gold;font-size:1.5em'> |
|
| 61 | + <?php echo $row['title']; ?> |
|
| 62 | 62 | </a><br> |
| 63 | 63 | <small> |
| 64 | 64 | <i> |
| 65 | 65 | Created by |
| 66 | - <a href='/?id=<?php echo getID($row["author"], $conn);?>'> |
|
| 67 | - <?php echo $row['author'];?> |
|
| 66 | + <a href='/?id=<?php echo getID($row["author"], $conn); ?>'> |
|
| 67 | + <?php echo $row['author']; ?> |
|
| 68 | 68 | </a> |
| 69 | 69 | </i><br> |
| 70 | 70 | <?php echo $row['date']?> |
@@ -80,12 +80,12 @@ discard block |
||
| 80 | 80 | $stmt->bind_param("i", $id); |
| 81 | 81 | $stmt->execute(); |
| 82 | 82 | $result = $stmt->get_result(); |
| 83 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 83 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 84 | 84 | $members = 0; |
| 85 | - while($row = $result->fetch_assoc()) { |
|
| 85 | + while ($row = $result->fetch_assoc()) { |
|
| 86 | 86 | $members++; |
| 87 | 87 | } |
| 88 | - echo "<span style='float:right;'><a href='/joingroup?id=" . $id. "'><button>Join</button></a></span>"; |
|
| 88 | + echo "<span style='float:right;'><a href='/joingroup?id=" . $id . "'><button>Join</button></a></span>"; |
|
| 89 | 89 | } else { |
| 90 | 90 | header("Location: viewgroups.php"); |
| 91 | 91 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | <hr> |
| 95 | 95 | <div> |
| 96 | 96 | <div class="left"> |
| 97 | - <?php if(isset($error)) {echo "<small style='color:red'>" . $error . "</small>";}?> |
|
| 97 | + <?php if (isset($error)) {echo "<small style='color:red'>" . $error . "</small>"; }?> |
|
| 98 | 98 | <h2>Comments</h2> |
| 99 | 99 | <?php if (isset($_SESSION['user'])) { ?> |
| 100 | 100 | <form method="post" enctype="multipart/form-data"> |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | $stmt->execute(); |
| 112 | 112 | $result = $stmt->get_result(); |
| 113 | 113 | |
| 114 | - while($row = $result->fetch_assoc()) { ?> |
|
| 114 | + while ($row = $result->fetch_assoc()) { ?> |
|
| 115 | 115 | <div class='commentRight' style='display: grid; grid-template-columns: 75% auto; padding:5px;'> |
| 116 | 116 | <div style="word-wrap: break-word;"> |
| 117 | 117 | <small><?php echo $row['date']; ?></small> |
| 118 | - <?php echo validateMarkdown($row['text']);?> |
|
| 118 | + <?php echo validateMarkdown($row['text']); ?> |
|
| 119 | 119 | </div> |
| 120 | 120 | <div> |
| 121 | 121 | <a style='float: right;' href='/?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a> |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | </div> |
| 128 | 128 | </div> |
| 129 | 129 | <div class="right"> |
| 130 | - <h2>Members (<?php echo $members;?>)</h2> |
|
| 130 | + <h2>Members (<?php echo $members; ?>)</h2> |
|
| 131 | 131 | <?php |
| 132 | 132 | $stmt = $conn->prepare("SELECT `username`, `id` FROM `users` WHERE `currentgroup` = ?"); |
| 133 | 133 | $stmt->bind_param("i", $id); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | echo "<ul>"; |
| 138 | 138 | while ($row = $result->fetch_assoc()) { |
| 139 | - echo "<li><a href='/?id=" . $row['id'] . "'>". $row['username'] . "</a></li>"; |
|
| 139 | + echo "<li><a href='/?id=" . $row['id'] . "'>" . $row['username'] . "</a></li>"; |
|
| 140 | 140 | } |
| 141 | 141 | echo "</ul>"; |
| 142 | 142 | ?> |
@@ -50,7 +50,9 @@ discard block |
||
| 50 | 50 | $stmt->bind_param("i", $_GET['id']); |
| 51 | 51 | $stmt->execute(); |
| 52 | 52 | $result = $stmt->get_result(); |
| 53 | - if($result->num_rows === 0) echo('Group doesnt exist.'); |
|
| 53 | + if($result->num_rows === 0) { |
|
| 54 | + echo('Group doesnt exist.'); |
|
| 55 | + } |
|
| 54 | 56 | while($row = $result->fetch_assoc()) { |
| 55 | 57 | $id = $row['id']; |
| 56 | 58 | ?> |
@@ -80,7 +82,9 @@ discard block |
||
| 80 | 82 | $stmt->bind_param("i", $id); |
| 81 | 83 | $stmt->execute(); |
| 82 | 84 | $result = $stmt->get_result(); |
| 83 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 85 | + if($result->num_rows === 0) { |
|
| 86 | + echo('There are no users.'); |
|
| 87 | + } |
|
| 84 | 88 | $members = 0; |
| 85 | 89 | while($row = $result->fetch_assoc()) { |
| 86 | 90 | $members++; |