@@ -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="/view/groups">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='/view/profile?id=<?php echo(getID($_SESSION['user'], $conn));?>'> |
|
| 37 | - <?php echo($_SESSION['user']);?> |
|
| 36 | + <a href='/view/profile?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> |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $stmt->bind_param("i", $_GET['id']); |
| 17 | 17 | $stmt->execute(); |
| 18 | 18 | $result = $stmt->get_result(); |
| 19 | - if($result->num_rows !== 0){ // echo('There are no users.'); // please just refuse to give a user if this is the case |
|
| 20 | - while($row = $result->fetch_assoc()) { // you dont need to use a loop if its only ever gonna return 1 or 0 |
|
| 19 | + if ($result->num_rows !== 0) { // echo('There are no users.'); // please just refuse to give a user if this is the case |
|
| 20 | + while ($row = $result->fetch_assoc()) { // you dont need to use a loop if its only ever gonna return 1 or 0 |
|
| 21 | 21 | $username = $row['username']; // you dont actually need all of these variables oh my god just use an array |
| 22 | 22 | $id = $row['id']; |
| 23 | 23 | $date = $row['date']; |
@@ -41,11 +41,11 @@ discard block |
||
| 41 | 41 | $stmt->bind_param("i", $currentgroup); |
| 42 | 42 | $stmt->execute(); |
| 43 | 43 | $result = $stmt->get_result(); |
| 44 | - if($result->num_rows !== 0){ //echo('There are no users.'); // why again |
|
| 45 | - while($row = $result->fetch_assoc()) { |
|
| 44 | + if ($result->num_rows !== 0) { //echo('There are no users.'); // why again |
|
| 45 | + while ($row = $result->fetch_assoc()) { |
|
| 46 | 46 | $grouptitle = $row['title']; |
| 47 | 47 | } |
| 48 | - }else{ |
|
| 48 | + } else { |
|
| 49 | 49 | $grouptitle = "none"; |
| 50 | 50 | } |
| 51 | 51 | $stmt->close(); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $result = $stmt->get_result(); |
| 57 | 57 | |
| 58 | 58 | $comments = 0; |
| 59 | - while($row = $result->fetch_assoc()) { |
|
| 59 | + while ($row = $result->fetch_assoc()) { |
|
| 60 | 60 | $comments++; |
| 61 | 61 | } |
| 62 | 62 | $stmt->close(); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $result = $stmt->get_result(); |
| 68 | 68 | |
| 69 | 69 | $profilecomments = 0; |
| 70 | - while($row = $result->fetch_assoc()) { |
|
| 70 | + while ($row = $result->fetch_assoc()) { |
|
| 71 | 71 | $profilecomments++; |
| 72 | 72 | } |
| 73 | 73 | $stmt->close(); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | $result = $stmt->get_result(); |
| 79 | 79 | |
| 80 | 80 | $filesuploaded = 0; |
| 81 | - while($row = $result->fetch_assoc()) { |
|
| 81 | + while ($row = $result->fetch_assoc()) { |
|
| 82 | 82 | $filesuploaded++; |
| 83 | 83 | } |
| 84 | 84 | $stmt->close(); |
@@ -96,12 +96,12 @@ discard block |
||
| 96 | 96 | </center> |
| 97 | 97 | <hr style="border-top: 1px dashed gray;"> |
| 98 | 98 | <div id="userinfo" style="padding-left: 20px;"> |
| 99 | - <span style="color: gold;">Rank:</span> <?php echo $rank;?><br> |
|
| 100 | - <span style="color: gold;">ID:</span> <?php echo $id;?><br> |
|
| 101 | - <span style="color: gold;">Other Comments:</span> <?php echo $comments;?><br> |
|
| 102 | - <span style="color: gold;">Profile Comments:</span> <?php echo $profilecomments;?><br> |
|
| 103 | - <span style="color: gold;">Current Group:</span> <?php echo $grouptitle;?><br> |
|
| 104 | - <span style="color: gold;">Files Uploaded:</span> <?php echo $filesuploaded;?> |
|
| 99 | + <span style="color: gold;">Rank:</span> <?php echo $rank; ?><br> |
|
| 100 | + <span style="color: gold;">ID:</span> <?php echo $id; ?><br> |
|
| 101 | + <span style="color: gold;">Other Comments:</span> <?php echo $comments; ?><br> |
|
| 102 | + <span style="color: gold;">Profile Comments:</span> <?php echo $profilecomments; ?><br> |
|
| 103 | + <span style="color: gold;">Current Group:</span> <?php echo $grouptitle; ?><br> |
|
| 104 | + <span style="color: gold;">Files Uploaded:</span> <?php echo $filesuploaded; ?> |
|
| 105 | 105 | </div><br> |
| 106 | 106 | <?php if (!isset($_GET["ed"])) { ?> |
| 107 | 107 | <audio autoplay controls> |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | </div> |
| 112 | 112 | <br> |
| 113 | 113 | <div class="notegray"> |
| 114 | - <?php if(isset($error)) { echo "<small style='color:red'>".$error."</small>"; } ?> |
|
| 114 | + <?php if (isset($error)) { echo "<small style='color:red'>" . $error . "</small>"; } ?> |
|
| 115 | 115 | <h2>Comment</h2> |
| 116 | 116 | <form method="post" enctype="multipart/form-data"> |
| 117 | 117 | <textarea required cols="33" placeholder="Comment" name="comment"></textarea><br> |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | <div id="badges" class="notegray"> |
| 131 | 131 | <h1>Badges</h1> |
| 132 | 132 | <?php |
| 133 | - foreach($badges as $badge) { |
|
| 134 | - if($badge == "good") { |
|
| 133 | + foreach ($badges as $badge) { |
|
| 134 | + if ($badge == "good") { |
|
| 135 | 135 | echo "<img width='70px;' height='70px;' src='https://cdn.discordapp.com/attachments/740680780740821105/740776214523936808/340juojg3h.png'>"; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | $stmt->bind_param("s", $username); |
| 144 | 144 | $stmt->execute(); |
| 145 | 145 | $result = $stmt->get_result(); |
| 146 | - if($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 146 | + if ($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 147 | 147 | |
| 148 | - while($row = $result->fetch_assoc()) { |
|
| 149 | - echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [' , $row['type'] . ']</a><br>'; |
|
| 148 | + while ($row = $result->fetch_assoc()) { |
|
| 149 | + echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [', $row['type'] . ']</a><br>'; |
|
| 150 | 150 | }?> |
| 151 | 151 | </div><br> |
| 152 | 152 | <div id="bio" class="notegray"> |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | $stmt->execute(); |
| 161 | 161 | $result = $stmt->get_result(); |
| 162 | 162 | |
| 163 | - while($row = $result->fetch_assoc()) { ?> |
|
| 163 | + while ($row = $result->fetch_assoc()) { ?> |
|
| 164 | 164 | <div class='commentRight' style='display: grid; grid-template-columns: 75% auto; padding:5px;'> |
| 165 | 165 | <div style="word-wrap: break-word;"> |
| 166 | 166 | <small><?php echo $row['date']; ?></small> |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | while($row = $result->fetch_assoc()) { |
| 46 | 46 | $grouptitle = $row['title']; |
| 47 | 47 | } |
| 48 | - }else{ |
|
| 48 | + } else{ |
|
| 49 | 49 | $grouptitle = "none"; |
| 50 | 50 | } |
| 51 | 51 | $stmt->close(); |
@@ -143,7 +143,9 @@ discard block |
||
| 143 | 143 | $stmt->bind_param("s", $username); |
| 144 | 144 | $stmt->execute(); |
| 145 | 145 | $result = $stmt->get_result(); |
| 146 | - if($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 146 | + if($result->num_rows > 0) { |
|
| 147 | + echo('<h1>Files</h1>'); |
|
| 148 | + } |
|
| 147 | 149 | |
| 148 | 150 | while($row = $result->fetch_assoc()) { |
| 149 | 151 | echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [' , $row['type'] . ']</a><br>'; |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | <div class="container"> |
| 24 | 24 | <br> |
| 25 | 25 | <?php |
| 26 | - if($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 26 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 27 | 27 | { |
| 28 | - if(!isset($_SESSION['user'])){ $error = "you are not logged in"; goto skipcomment; } |
|
| 29 | - if(!$_POST['comment']){ $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 30 | - if(strlen($_POST['comment']) > 500){ $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 28 | + if (!isset($_SESSION['user'])) { $error = "you are not logged in"; goto skipcomment; } |
|
| 29 | + if (!$_POST['comment']) { $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 30 | + if (strlen($_POST['comment']) > 500) { $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 31 | 31 | |
| 32 | 32 | $stmt = $conn->prepare("INSERT INTO `comments` (toid, author, text) VALUES (?, ?, ?)"); |
| 33 | 33 | $stmt->bind_param("sss", $_GET['id'], $_SESSION['user'], $text); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | <a href="/media">Featured</a><br> |
| 59 | 59 | <?php |
| 60 | - if(isset($_SESSION['user'])) { echo "<a href='/home'>Manage</a><br><a href='/files'>Files<a>"; } |
|
| 60 | + if (isset($_SESSION['user'])) { echo "<a href='/home'>Manage</a><br><a href='/files'>Files<a>"; } |
|
| 61 | 61 | ?> |
| 62 | 62 | </div> |
| 63 | 63 | <br> |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='review' AND status='y' ORDER BY RAND() LIMIT 1"); |
| 68 | 68 | $stmt->execute(); |
| 69 | 69 | $result = $stmt->get_result(); |
| 70 | - while($row = $result->fetch_assoc()) { |
|
| 70 | + while ($row = $result->fetch_assoc()) { |
|
| 71 | 71 | echo "<br><img style='height: 5em;position: absolute;border: 1px solid white; width: 5em;' src='/dynamic/pfp/" . getPFP($row['author'], $conn) . "'> |
| 72 | 72 | <small> |
| 73 | 73 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>[" . $row['agerating'] . "] " . $row['title'] . "</a></i></span><br> |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='news' AND status='y' ORDER BY RAND() LIMIT 1"); |
| 84 | 84 | $stmt->execute(); |
| 85 | 85 | $result = $stmt->get_result(); |
| 86 | - while($row = $result->fetch_assoc()) { |
|
| 86 | + while ($row = $result->fetch_assoc()) { |
|
| 87 | 87 | echo "<br><img style='height: 5em;position: absolute;border: 1px solid white; width: 5em;' src='/dynamic/pfp/" . getPFP($row['author'], $conn) . "'> |
| 88 | 88 | <small> |
| 89 | 89 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'>[" . $row['agerating'] . "] <i>" . $row['title'] . "</a></i></span><br> |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC"); |
| 100 | 100 | $stmt->execute(); |
| 101 | 101 | $result = $stmt->get_result(); |
| 102 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 103 | - while($row = $result->fetch_assoc()) { |
|
| 102 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 103 | + while ($row = $result->fetch_assoc()) { |
|
| 104 | 104 | $id = 1; |
| 105 | 105 | echo "<div class='item" . $id . "'><img style='height: 8em;width: 8em;' src='/dynamic/pfp/" . getPFP($row['username'], $conn) . "'><br><a href='/view/profile?id=" . $row['id'] . "'>" . $row['username'] . "</a></div>"; |
| 106 | 106 | $id = $id + 1; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='image' AND status='y' ORDER BY RAND() LIMIT 6"); |
| 118 | 118 | $stmt->execute(); |
| 119 | 119 | $result = $stmt->get_result(); |
| 120 | - while($row = $result->fetch_assoc()) { |
|
| 120 | + while ($row = $result->fetch_assoc()) { |
|
| 121 | 121 | echo "<div style='display: inline-block;' class='notegray'> |
| 122 | 122 | <a href='/view?id=" . $row['id'] . "'><img style='width: 7.5em;height: 7.5em;' src='/dynamic/image/" . $row['filename'] . "'> |
| 123 | 123 | <br><center><b>" . htmlspecialchars($row['title']) . "</b><br><span style='color: gray;'>By " . $row['author'] . "</span></center> |
@@ -99,7 +99,9 @@ |
||
| 99 | 99 | $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC"); |
| 100 | 100 | $stmt->execute(); |
| 101 | 101 | $result = $stmt->get_result(); |
| 102 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 102 | + if($result->num_rows === 0) { |
|
| 103 | + echo('There are no users.'); |
|
| 104 | + } |
|
| 103 | 105 | while($row = $result->fetch_assoc()) { |
| 104 | 106 | $id = 1; |
| 105 | 107 | echo "<div class='item" . $id . "'><img style='height: 8em;width: 8em;' src='/dynamic/pfp/" . getPFP($row['username'], $conn) . "'><br><a href='/view/profile?id=" . $row['id'] . "'>" . $row['username'] . "</a></div>"; |
@@ -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 | } |
@@ -43,26 +43,26 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | skipcomment: |
| 45 | 45 | |
| 46 | - if(isset($_GET['id'])) { |
|
| 46 | + if (isset($_GET['id'])) { |
|
| 47 | 47 | $stmt = $conn->prepare("SELECT * FROM `groups` WHERE id = ?"); |
| 48 | 48 | $stmt->bind_param("i", $_GET['id']); |
| 49 | 49 | $stmt->execute(); |
| 50 | 50 | $result = $stmt->get_result(); |
| 51 | - if($result->num_rows === 0) echo('Group doesnt exist.'); |
|
| 52 | - while($row = $result->fetch_assoc()) { |
|
| 51 | + if ($result->num_rows === 0) echo('Group doesnt exist.'); |
|
| 52 | + while ($row = $result->fetch_assoc()) { |
|
| 53 | 53 | $id = $row['id']; |
| 54 | 54 | ?> |
| 55 | 55 | <img style='border: 1px solid white; width: 5em;' |
| 56 | - src='/dynamic/pfp/<?php echo getPFP($row["author"], $conn);?>'> |
|
| 56 | + src='/dynamic/pfp/<?php echo getPFP($row["author"], $conn); ?>'> |
|
| 57 | 57 | <span style='float: right;text-align: right;'> |
| 58 | - <a href='/view/group?id=<?php echo $row["id"];?>' style='color: gold;font-size:1.5em'> |
|
| 59 | - <?php echo $row['title'];?> |
|
| 58 | + <a href='/view/group?id=<?php echo $row["id"]; ?>' style='color: gold;font-size:1.5em'> |
|
| 59 | + <?php echo $row['title']; ?> |
|
| 60 | 60 | </a><br> |
| 61 | 61 | <small> |
| 62 | 62 | <i> |
| 63 | 63 | Created by |
| 64 | - <a href='/view/profile?id=<?php echo getID($row["author"], $conn);?>'> |
|
| 65 | - <?php echo $row['author'];?> |
|
| 64 | + <a href='/view/profile?id=<?php echo getID($row["author"], $conn); ?>'> |
|
| 65 | + <?php echo $row['author']; ?> |
|
| 66 | 66 | </a> |
| 67 | 67 | </i><br> |
| 68 | 68 | <?php echo $row['date']?> |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | $stmt->bind_param("i", $id); |
| 79 | 79 | $stmt->execute(); |
| 80 | 80 | $result = $stmt->get_result(); |
| 81 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 81 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 82 | 82 | $members = 0; |
| 83 | - while($row = $result->fetch_assoc()) { |
|
| 83 | + while ($row = $result->fetch_assoc()) { |
|
| 84 | 84 | $members++; |
| 85 | 85 | } |
| 86 | - echo "<span style='float:right;'><a href='/joingroup?id=" . $id. "'><button>Join</button></a></span>"; |
|
| 86 | + echo "<span style='float:right;'><a href='/joingroup?id=" . $id . "'><button>Join</button></a></span>"; |
|
| 87 | 87 | } else { |
| 88 | 88 | header("Location: view/groups.php"); |
| 89 | 89 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | <hr> |
| 93 | 93 | <div> |
| 94 | 94 | <div class="left"> |
| 95 | - <?php if(isset($error)) {echo "<small style='color:red'>" . $error . "</small>";}?> |
|
| 95 | + <?php if (isset($error)) {echo "<small style='color:red'>" . $error . "</small>"; }?> |
|
| 96 | 96 | <h2>Comments</h2> |
| 97 | 97 | <?php if (isset($_SESSION['user'])) { ?> |
| 98 | 98 | <form method="post" enctype="multipart/form-data"> |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | $stmt->execute(); |
| 110 | 110 | $result = $stmt->get_result(); |
| 111 | 111 | |
| 112 | - while($row = $result->fetch_assoc()) { ?> |
|
| 112 | + while ($row = $result->fetch_assoc()) { ?> |
|
| 113 | 113 | <div class='commentRight' style='display: grid; grid-template-columns: 75% auto; padding:5px;'> |
| 114 | 114 | <div style="word-wrap: break-word;"> |
| 115 | 115 | <small><?php echo $row['date']; ?></small> |
| 116 | - <?php echo validateMarkdown($row['text']);?> |
|
| 116 | + <?php echo validateMarkdown($row['text']); ?> |
|
| 117 | 117 | </div> |
| 118 | 118 | <div> |
| 119 | 119 | <a style='float: right;' href='/view/profile?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a> |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | </div> |
| 126 | 126 | </div> |
| 127 | 127 | <div class="right"> |
| 128 | - <h2>Members (<?php echo $members;?>)</h2> |
|
| 128 | + <h2>Members (<?php echo $members; ?>)</h2> |
|
| 129 | 129 | <?php |
| 130 | 130 | $stmt = $conn->prepare("SELECT `username`, `id` FROM `users` WHERE `currentgroup` = ?"); |
| 131 | 131 | $stmt->bind_param("i", $id); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | echo "<ul>"; |
| 136 | 136 | while ($row = $result->fetch_assoc()) { |
| 137 | - echo "<li><a href='/view/profile?id=" . $row['id'] . "'>". $row['username'] . "</a></li>"; |
|
| 137 | + echo "<li><a href='/view/profile?id=" . $row['id'] . "'>" . $row['username'] . "</a></li>"; |
|
| 138 | 138 | } |
| 139 | 139 | echo "</ul>"; |
| 140 | 140 | ?> |
@@ -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='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='/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>"; |
@@ -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> |
@@ -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,21 +28,21 @@ 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 = "dynamic/pfp/"; |
| 47 | 47 | $target_name = md5_file($_FILES["fileToUpload"]["tmp_name"]); |
| 48 | 48 | $imageFileType = strtolower(pathinfo($_FILES["fileToUpload"]["name"], PATHINFO_EXTENSION)); |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | $uploadOk = true; |
| 53 | 53 | $movedFile = false; |
| 54 | 54 | |
| 55 | - if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 56 | - && $imageFileType != "gif" ) { |
|
| 55 | + if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" |
|
| 56 | + && $imageFileType != "gif") { |
|
| 57 | 57 | echo 'unsupported file type. must be jpg, png, jpeg, or gif<hr>'; |
| 58 | 58 | $uploadOk = false; |
| 59 | 59 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | echo 'fatal error<hr>'; |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | - } else if(@$_POST['photoset']) { |
|
| 78 | + } else if (@$_POST['photoset']) { |
|
| 79 | 79 | $uploadOk = true; |
| 80 | 80 | $movedFile = false; |
| 81 | 81 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | $target_file = $target_dir . $target_name . "." . $imageFileType; |
| 87 | 87 | |
| 88 | - if($songFileType != "ogg" && $songFileType != "mp3") { |
|
| 88 | + if ($songFileType != "ogg" && $songFileType != "mp3") { |
|
| 89 | 89 | echo 'unsupported file type. must be mp3 or ogg<hr>'; |
| 90 | 90 | $uploadOk = false; |
| 91 | 91 | } |
@@ -124,14 +124,14 @@ discard block |
||
| 124 | 124 | <button><a href="/2fa">Manage 2-Factor Authentication</a></button><br><br> |
| 125 | 125 | <b>Bio</b> |
| 126 | 126 | <form method="post" enctype="multipart/form-data"> |
| 127 | - <textarea required cols="58" placeholder="Bio" name="bio"><?php echo $bio;?></textarea><br> |
|
| 127 | + <textarea required cols="58" placeholder="Bio" name="bio"><?php echo $bio; ?></textarea><br> |
|
| 128 | 128 | <input name="bioset" type="submit" value="Set"> |
| 129 | 129 | <small>max limit: 500 characters | supports <a href="https://www.markdownguide.org/basic-syntax">Markdown</a></small> |
| 130 | 130 | </form><br> |
| 131 | 131 | <b>CSS</b> |
| 132 | 132 | <button onclick="loadpfwin()" id="prevbtn">Show Live CSS Preview</button> |
| 133 | 133 | <form method="post" enctype="multipart/form-data"> |
| 134 | - <textarea required rows="15" cols="58" placeholder="Your CSS" name="css" id="css_code"><?php echo $css;?></textarea><br> |
|
| 134 | + <textarea required rows="15" cols="58" placeholder="Your CSS" name="css" id="css_code"><?php echo $css; ?></textarea><br> |
|
| 135 | 135 | <input name="cssset" type="submit" value="Set"> <small>max limit: 5000 characters</small> |
| 136 | 136 | </form><br> |
| 137 | 137 | </div> |
@@ -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 | } |