Passed
Pull Request — master (#20)
by
unknown
01:53
created
upload/image.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
     <body> 
13 13
         <?php require(__DIR__ . "/../important/header.php"); 
14 14
         
15
-        if(@$_POST['submit']) {
15
+        if (@$_POST['submit']) {
16 16
             $register = require(__DIR__ . "/../func/upload.php");
17 17
             $register("image", ["gif", "png", "jpg", "jpeg"], $conn);
18 18
         }
Please login to merge, or discard this patch.
2fa/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
         <?php require(__DIR__ . "/../important/header.php"); ?>
22 22
         <div class="container">
23 23
              <h1>2-Factor Authentication</h1>
24
-             2FA status: <?php if ($otpstatus) {echo "enabled";} else {echo "disabled";}?><br>
25
-             <?php if ($otpstatus) {echo "Backup code: " . $result->fetch_assoc()['otpbackupcode'];} ?><br><br>
24
+             2FA status: <?php if ($otpstatus) {echo "enabled"; } else {echo "disabled"; }?><br>
25
+             <?php if ($otpstatus) {echo "Backup code: " . $result->fetch_assoc()['otpbackupcode']; } ?><br><br>
26 26
              <button>
27 27
              <?php if ($otpstatus) { ?>
28 28
              <a href="/2fa/disable">Disable 2FA</a>
Please login to merge, or discard this patch.
2fa/enable.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@
 block discarded – undo
43 43
     <body>
44 44
         <?php require(__DIR__ . "/../important/header.php"); ?>
45 45
         <div class="container">
46
-            <?php if (isset($err)) {echo "<b style='color:red;'>" . $err . "</b><br><br>";}?>
46
+            <?php if (isset($err)) {echo "<b style='color:red;'>" . $err . "</b><br><br>"; }?>
47 47
             To enable 2FA, scan the following QR code with your authenticator app:<br><br>
48 48
             <img src="<?php echo $totp->getQrCodeUri(
49 49
                 'https://api.qrserver.com/v1/create-qr-code/?data=[DATA]&size=300x300&ecc=M&qzone=1&format=png',
50 50
                 '[DATA]'
51
-            );?>"><br><br>
51
+            ); ?>"><br><br>
52 52
             Or use the following string: <b><?php echo $secret; ?></b><br>
53 53
             Then type the 6-digit code your app generates below and click 'Submit':<br><br>
54 54
             <form method="post" enctype="multipart/form-data">
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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='/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
 block discarded – undo
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='/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
 block discarded – undo
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='/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
 block discarded – undo
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>
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -99,7 +99,9 @@
 block discarded – undo
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='/pfp/" . getPFP($row['username'], $conn) . "'><br><a href='/view/profile?id=" . $row['id'] . "'>" . $row['username'] . "</a></div>";
Please login to merge, or discard this patch.
important/header.php 1 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='/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
         &bull; <a href='/home'>Manage</a>
40 40
         &bull; <a href='/logout'>Logout</a>
Please login to merge, or discard this patch.
view/profile.php 2 patches
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>';
Please login to merge, or discard this patch.
view/group.php 1 patch
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
                     }
@@ -43,26 +43,26 @@  discard block
 block discarded – undo
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='/pfp/<?php echo getPFP($row["author"], $conn);?>'>
56
+                             src='/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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
                     ?>
Please login to merge, or discard this patch.