Passed
Pull Request — master (#10)
by
unknown
01:54
created
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
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="/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
         &bull; <a href='/home'>Manage</a>
40 40
         &bull; <a href='/logout'>Logout</a>
Please login to merge, or discard this patch.
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.
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.
viewgroup.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                     ?>
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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++;
Please login to merge, or discard this patch.
viewgroups.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@
 block discarded – undo
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='/pfp/" . getPFP($row['author'], $conn) . "'>
24 24
                     <small>
25 25
                     <a href='/viewgroup?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>" . $row['title'] . "</a></i></span><br>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,9 @@
 block discarded – undo
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='/pfp/" . getPFP($row['author'], $conn) . "'>
24 26
                     <small>
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.