Passed
Pull Request — master (#20)
by
unknown
01:56
created
index.php 2 patches
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>";
Please login to merge, or discard this patch.
home.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@
 block discarded – undo
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'];
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
important/header.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
31 31
     &bull; <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='/?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
         &bull; <a href='/home'>Manage</a>
40 40
         &bull; <a href='/logout'>Logout</a>
Please login to merge, or discard this patch.
uploadmidi.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
uploadart.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
files.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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='/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>
Please login to merge, or discard this patch.
adminpanel/ban.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
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) == "admin") {
4
+if (isset($_SESSION['user'])) {
5
+    if (isset($_GET['id'])) {
6
+        if (isAdmin($_SESSION['user'], $conn) == "admin") {
7 7
             $stmt = $conn->prepare("DELETE FROM users WHERE id = ?");
8 8
             $stmt->bind_param("i", $_GET['id']);
9 9
             $stmt->execute();
Please login to merge, or discard this patch.
adminpanel/deny.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
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) == "admin") {
4
+if (isset($_SESSION['user'])) {
5
+    if (isset($_GET['id'])) {
6
+        if (isAdmin($_SESSION['user'], $conn) == "admin") {
7 7
             $stmt = $conn->prepare("UPDATE files SET status = 'd' WHERE id = ?");
8 8
             $stmt->bind_param("i", $_GET['id']);
9 9
             $stmt->execute();
Please login to merge, or discard this patch.
adminpanel/index.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require("dependencies.php");
3 3
 
4
-if(isset($_SESSION['user'])) {
5
-    if(isAdmin($_SESSION['user'], $conn) == "admin") {
4
+if (isset($_SESSION['user'])) {
5
+    if (isAdmin($_SESSION['user'], $conn) == "admin") {
6 6
         echo "<h1>Welcome</h1>";
7 7
     } else {
8 8
         die("not a admin");
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
     $stmt = $conn->prepare("SELECT * FROM files WHERE status = 'n'");
34 34
     $stmt->execute();
35 35
     $result = $stmt->get_result();
36
-    if($result->num_rows === 0) echo('There are no items waiting for approval.');
37
-    while($row = $result->fetch_assoc()) {
36
+    if ($result->num_rows === 0) echo('There are no items waiting for approval.');
37
+    while ($row = $result->fetch_assoc()) {
38 38
         echo "" . $row['title'] . " by " . $row['author'] . " @ " . $row['date'] . " | <a href='approve.php?id=" . $row['id'] . "'>Approve</a> | <a href='deny.php?id=" . $row['id'] . "'>Deny</a><br>";
39 39
     }
40 40
 ?>
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
     $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC");
46 46
     $stmt->execute();
47 47
     $result = $stmt->get_result();
48
-    if($result->num_rows === 0) echo('There are no items waiting for approval.');
49
-    while($row = $result->fetch_assoc()) {
48
+    if ($result->num_rows === 0) echo('There are no items waiting for approval.');
49
+    while ($row = $result->fetch_assoc()) {
50 50
         echo "<a href='/index.php?id=" . $row['id'] . "'>" . $row['username'] . "</a> | <a href='ban.php?id=" . $row['id'] . "'>Ban</a><br>";
51 51
     }
52 52
 ?>
53 53
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
     $stmt = $conn->prepare("SELECT * FROM files WHERE status = 'n'");
34 34
     $stmt->execute();
35 35
     $result = $stmt->get_result();
36
-    if($result->num_rows === 0) echo('There are no items waiting for approval.');
36
+    if($result->num_rows === 0) {
37
+        echo('There are no items waiting for approval.');
38
+    }
37 39
     while($row = $result->fetch_assoc()) {
38 40
         echo "" . $row['title'] . " by " . $row['author'] . " @ " . $row['date'] . " | <a href='approve.php?id=" . $row['id'] . "'>Approve</a> | <a href='deny.php?id=" . $row['id'] . "'>Deny</a><br>";
39 41
     }
@@ -45,7 +47,9 @@  discard block
 block discarded – undo
45 47
     $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC");
46 48
     $stmt->execute();
47 49
     $result = $stmt->get_result();
48
-    if($result->num_rows === 0) echo('There are no items waiting for approval.');
50
+    if($result->num_rows === 0) {
51
+        echo('There are no items waiting for approval.');
52
+    }
49 53
     while($row = $result->fetch_assoc()) {
50 54
         echo "<a href='/index.php?id=" . $row['id'] . "'>" . $row['username'] . "</a> | <a href='ban.php?id=" . $row['id'] . "'>Ban</a><br>";
51 55
     }
Please login to merge, or discard this patch.