@@ -18,8 +18,8 @@ |
||
| 18 | 18 | $stmt = $conn->prepare("SELECT * FROM `groups` ORDER BY id DESC"); |
| 19 | 19 | $stmt->execute(); |
| 20 | 20 | $result = $stmt->get_result(); |
| 21 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 22 | - while($row = $result->fetch_assoc()) { |
|
| 21 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 22 | + while ($row = $result->fetch_assoc()) { |
|
| 23 | 23 | echo "<img style='position: absolute;border: 1px solid white; width: 5em;' src='/dynamic/pfp/" . getPFP($row['author'], $conn) . "'> |
| 24 | 24 | <small> |
| 25 | 25 | <a href='/view/group?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>" . $row['title'] . "</a></i></span><br> |
@@ -18,7 +18,9 @@ |
||
| 18 | 18 | $stmt = $conn->prepare("SELECT * FROM `groups` ORDER BY id DESC"); |
| 19 | 19 | $stmt->execute(); |
| 20 | 20 | $result = $stmt->get_result(); |
| 21 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 21 | + if($result->num_rows === 0) { |
|
| 22 | + echo('There are no users.'); |
|
| 23 | + } |
|
| 22 | 24 | while($row = $result->fetch_assoc()) { |
| 23 | 25 | echo "<img style='position: absolute;border: 1px solid white; width: 5em;' src='/dynamic/pfp/" . getPFP($row['author'], $conn) . "'> |
| 24 | 26 | <small> |
@@ -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 | $stmt = $conn->prepare("INSERT INTO files (type, title, extrainfo, author, filename) VALUES ('review', ?, ?, ?, '')"); |
| 18 | 18 | $stmt->bind_param("sss", $title, $description, $_SESSION['user']); |
| 19 | 19 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $stmt->execute(); |
| 35 | 35 | $result = $stmt->get_result(); |
| 36 | 36 | |
| 37 | - while($row = $result->fetch_assoc()) { |
|
| 37 | + while ($row = $result->fetch_assoc()) { |
|
| 38 | 38 | echo "<br><img style='position: absolute;border: 1px solid white; width: 5em;' src='/dynamic/pfp/" . getPFP($row['author'], $conn) . "'> |
| 39 | 39 | <small> |
| 40 | 40 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>[" . $row['agerating'] . "] " . $row['title'] . "</a></i></span><br> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | return function($type, $allowedFileTypes, $conn) { |
| 3 | - if(isset($_SESSION['user'])) { |
|
| 3 | + if (isset($_SESSION['user'])) { |
|
| 4 | 4 | $fileType = strtolower(pathinfo($_FILES["fileToUpload"]["name"], PATHINFO_EXTENSION)); |
| 5 | 5 | $target_dir = __DIR__ . "/../dynamic/" . $type . "/"; |
| 6 | 6 | $target_name = md5_file($_FILES["fileToUpload"]["tmp_name"]) . "." . $fileType; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $movedFile = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - if(!in_array($fileType, $allowedFileTypes)) { |
|
| 18 | + if (!in_array($fileType, $allowedFileTypes)) { |
|
| 19 | 19 | echo 'unsupported file type. must be one of ' . join(", ", $allowedFileTypes) . '<hr>'; |
| 20 | 20 | $uploadOk = false; |
| 21 | 21 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $stmt = $conn->prepare("SELECT * FROM files WHERE id = 27"); |
| 20 | 20 | $stmt->execute(); |
| 21 | 21 | $result = $stmt->get_result(); |
| 22 | - while($row = $result->fetch_assoc()) { |
|
| 22 | + while ($row = $result->fetch_assoc()) { |
|
| 23 | 23 | echo "<br><img style='height: 5em;position: absolute;border: 1px solid white; width: 5em;' src='/dynamic/pfp/" . getPFP($row['author'], $conn) . "'> |
| 24 | 24 | <small> |
| 25 | 25 | <a href='view.php?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>[" . $row['agerating'] . "] " . $row['title'] . "</a></i></span><br> |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $stmt = $conn->prepare("SELECT * FROM files WHERE id = 1"); |
| 39 | 39 | $stmt->execute(); |
| 40 | 40 | $result = $stmt->get_result(); |
| 41 | - while($row = $result->fetch_assoc()) { |
|
| 41 | + while ($row = $result->fetch_assoc()) { |
|
| 42 | 42 | echo "<br><img style='height: 5em;position: absolute;border: 1px solid white; width: 5em;' src='/dynamic/pfp/" . getPFP($row['author'], $conn) . "'> |
| 43 | 43 | <small> |
| 44 | 44 | <a href='view.php?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>[" . $row['agerating'] . "] " . $row['title'] . "</a></i></span><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="/dynamic/song/' . $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='/dynamic/image/" . $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='/dynamic/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>"; |
@@ -95,7 +95,9 @@ |
||
| 95 | 95 | $stmt->bind_param("s", $username); |
| 96 | 96 | $stmt->execute(); |
| 97 | 97 | $result = $stmt->get_result(); |
| 98 | - if($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 98 | + if($result->num_rows > 0) { |
|
| 99 | + echo('<h1>Files</h1>'); |
|
| 100 | + } |
|
| 99 | 101 | |
| 100 | 102 | while($row = $result->fetch_assoc()) { |
| 101 | 103 | echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [' , $row['type'] . ']</a><br>'; |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | <body> |
| 19 | 19 | <?php require(__DIR__ . "/../important/header.php"); |
| 20 | 20 | |
| 21 | - if($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 21 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 22 | 22 | { |
| 23 | - if(!isset($_SESSION['user'])){ $error = "you are not logged in"; goto skipcomment; } |
|
| 24 | - if(!$_POST['comment']){ $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 25 | - if(strlen($_POST['comment']) > 500){ $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 23 | + if (!isset($_SESSION['user'])) { $error = "you are not logged in"; goto skipcomment; } |
|
| 24 | + if (!$_POST['comment']) { $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 25 | + if (strlen($_POST['comment']) > 500) { $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 26 | 26 | |
| 27 | 27 | $stmt = $conn->prepare("INSERT INTO `comments` (toid, author, text) VALUES (?, ?, ?)"); |
| 28 | 28 | $stmt->bind_param("sss", $_GET['id'], $_SESSION['user'], $text); |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | </center> |
| 48 | 48 | <hr style="border-top: 1px dashed gray;"> |
| 49 | 49 | <div id="userinfo" style="padding-left: 20px;"> |
| 50 | - <span style="color: gold;">Rank:</span> <?php echo $user['rank'];?><br> |
|
| 51 | - <span style="color: gold;">ID:</span> <?php echo $user['id'];?><br> |
|
| 52 | - <span style="color: gold;">Other Comments:</span> <?php echo $user['comments'];?><br> |
|
| 53 | - <span style="color: gold;">Profile Comments:</span> <?php echo $user['profilecomments'];?><br> |
|
| 54 | - <?php $userGroup = getGroup($user['currentgroup'], $conn);?> |
|
| 55 | - <span style="color: gold;">Current Group:</span> <a href="/view/group?id=<?php echo $userGroup['id'];?>"><?php echo $userGroup['title'];?></a><br> |
|
| 56 | - <span style="color: gold;">Files Uploaded:</span> <?php echo $user['filesuploaded'];?> |
|
| 50 | + <span style="color: gold;">Rank:</span> <?php echo $user['rank']; ?><br> |
|
| 51 | + <span style="color: gold;">ID:</span> <?php echo $user['id']; ?><br> |
|
| 52 | + <span style="color: gold;">Other Comments:</span> <?php echo $user['comments']; ?><br> |
|
| 53 | + <span style="color: gold;">Profile Comments:</span> <?php echo $user['profilecomments']; ?><br> |
|
| 54 | + <?php $userGroup = getGroup($user['currentgroup'], $conn); ?> |
|
| 55 | + <span style="color: gold;">Current Group:</span> <a href="/view/group?id=<?php echo $userGroup['id']; ?>"><?php echo $userGroup['title']; ?></a><br> |
|
| 56 | + <span style="color: gold;">Files Uploaded:</span> <?php echo $user['filesuploaded']; ?> |
|
| 57 | 57 | </div><br> |
| 58 | 58 | <?php if (!isset($_GET["ed"])) { ?> |
| 59 | 59 | <audio autoplay controls> |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | </div> |
| 64 | 64 | <br> |
| 65 | 65 | <div class="notegray"> |
| 66 | - <?php if(isset($error)) { echo "<small style='color:red'>".$error."</small>"; } ?> |
|
| 66 | + <?php if (isset($error)) { echo "<small style='color:red'>" . $error . "</small>"; } ?> |
|
| 67 | 67 | <h2>Comment</h2> |
| 68 | 68 | <form method="post" enctype="multipart/form-data"> |
| 69 | 69 | <textarea required cols="33" placeholder="Comment" name="comment"></textarea><br> |
@@ -82,8 +82,8 @@ discard block |
||
| 82 | 82 | <div id="badges" class="notegray"> |
| 83 | 83 | <h1>Badges</h1> |
| 84 | 84 | <?php |
| 85 | - foreach($user['badges'] as $badge) { |
|
| 86 | - if($badge == "good") { |
|
| 85 | + foreach ($user['badges'] as $badge) { |
|
| 86 | + if ($badge == "good") { |
|
| 87 | 87 | echo "<img width='70px;' height='70px;' src='https://cdn.discordapp.com/attachments/740680780740821105/740776214523936808/340juojg3h.png'>"; |
| 88 | 88 | } |
| 89 | 89 | } |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | $stmt->bind_param("s", $username); |
| 96 | 96 | $stmt->execute(); |
| 97 | 97 | $result = $stmt->get_result(); |
| 98 | - if($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 98 | + if ($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 99 | 99 | |
| 100 | - while($row = $result->fetch_assoc()) { |
|
| 101 | - echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [' , $row['type'] . ']</a><br>'; |
|
| 100 | + while ($row = $result->fetch_assoc()) { |
|
| 101 | + echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [', $row['type'] . ']</a><br>'; |
|
| 102 | 102 | }?> |
| 103 | 103 | </div><br> |
| 104 | 104 | <div id="bio" class="notegray"> |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $stmt->execute(); |
| 113 | 113 | $result = $stmt->get_result(); |
| 114 | 114 | |
| 115 | - while($row = $result->fetch_assoc()) { ?> |
|
| 115 | + while ($row = $result->fetch_assoc()) { ?> |
|
| 116 | 116 | <div class='commentRight' style='display: grid; grid-template-columns: 75% auto; padding:5px;'> |
| 117 | 117 | <div class="commentText" style="word-wrap: break-word;"> |
| 118 | 118 | <small><?php echo $row['date']; ?></small> |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require("dependencies.php"); |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['user'])) { |
|
| 5 | - if(isset($_GET['id'])) { |
|
| 6 | - if(isAdmin($_SESSION['user'], $conn)) { |
|
| 4 | +if (isset($_SESSION['user'])) { |
|
| 5 | + if (isset($_GET['id'])) { |
|
| 6 | + if (isAdmin($_SESSION['user'], $conn)) { |
|
| 7 | 7 | $stmt = $conn->prepare("DELETE FROM users WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require("dependencies.php"); |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['user'])) { |
|
| 5 | - if(isset($_GET['id'])) { |
|
| 6 | - if(isAdmin($_SESSION['user'], $conn)) { |
|
| 4 | +if (isset($_SESSION['user'])) { |
|
| 5 | + if (isset($_GET['id'])) { |
|
| 6 | + if (isAdmin($_SESSION['user'], $conn)) { |
|
| 7 | 7 | $stmt = $conn->prepare("UPDATE files SET status = 'd' WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require("dependencies.php"); |
| 3 | 3 | |
| 4 | -if(isset($_SESSION['user'])) { |
|
| 5 | - if(isset($_GET['id'])) { |
|
| 6 | - if(isAdmin($_SESSION['user'], $conn)) { |
|
| 4 | +if (isset($_SESSION['user'])) { |
|
| 5 | + if (isset($_GET['id'])) { |
|
| 6 | + if (isAdmin($_SESSION['user'], $conn)) { |
|
| 7 | 7 | $stmt = $conn->prepare("UPDATE files SET status = 'y' WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |