Passed
Push — master ( 12222b...ea458a )
by Maxwell
02:05
created
view.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
             require(__DIR__ . "/func/func.php");
8 8
             require(__DIR__ . "/func/conn.php"); 
9 9
 
10
-            if(isset($_GET['id'])) {
10
+            if (isset($_GET['id'])) {
11 11
                 $stmt = $conn->prepare("SELECT * FROM files WHERE id = ?");
12 12
                 $stmt->bind_param("i", $_GET['id']);
13 13
                 $stmt->execute();
14 14
                 $result = $stmt->get_result();
15
-                if($result->num_rows === 0) echo('There are no users.');
16
-                while($row = $result->fetch_assoc()) {
15
+                if ($result->num_rows === 0) echo('There are no users.');
16
+                while ($row = $result->fetch_assoc()) {
17 17
                     $author = $row['author'];
18 18
                     $id = $row['id'];
19 19
                     $date = $row['date'];
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
                     $status = $row['status'];
24 24
                     $filename = $row['filename'];
25 25
 
26
-                    if($status != "y") {
26
+                    if ($status != "y") {
27 27
                         die("Item is not approved yet.");
28 28
                     }
29 29
                 }
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
         
38 38
         <div class="container">
39 39
             <?php
40
-                if($_SERVER['REQUEST_METHOD'] == 'POST') 
40
+                if ($_SERVER['REQUEST_METHOD'] == 'POST') 
41 41
                 {
42
-                    if(!isset($_SESSION['user'])){ $error = "you are not logged in"; goto skipcomment; }
43
-                    if(!$_POST['comment']){ $error = "your comment cannot be blank"; goto skipcomment; }
44
-                    if(strlen($_POST['comment']) > 500){ $error = "your comment must be shorter than 500 characters"; goto skipcomment; }
45
-                    if(!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; }
46
-                    if(!validateCaptcha(CAPTCHA_PRIVATEKEY, $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; }
42
+                    if (!isset($_SESSION['user'])) { $error = "you are not logged in"; goto skipcomment; }
43
+                    if (!$_POST['comment']) { $error = "your comment cannot be blank"; goto skipcomment; }
44
+                    if (strlen($_POST['comment']) > 500) { $error = "your comment must be shorter than 500 characters"; goto skipcomment; }
45
+                    if (!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; }
46
+                    if (!validateCaptcha(CAPTCHA_PRIVATEKEY, $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; }
47 47
 
48 48
                     $stmt = $conn->prepare("INSERT INTO `gamecomments` (toid, author, text, date) VALUES (?, ?, ?, now())");
49 49
                     $stmt->bind_param("sss", $_GET['id'], $_SESSION['user'], $text);
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
                     $stmt->close();
53 53
                 }
54 54
                 skipcomment:
55
-                if(isset($error)) {
55
+                if (isset($error)) {
56 56
                     echo "<span style='color: red;'><small>" . $error . "</small></span><br>";
57 57
                 }
58 58
 
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
                 <br><br>" . $extrainfo . "</small><hr>";
65 65
             ?>
66 66
             <?php 
67
-            if($type == "song") {
67
+            if ($type == "song") {
68 68
                 echo '<audio controls>
69 69
                 <source src="/musicfiles/' . $filename . '">
70 70
                 </audio>';
71
-            } else if($type == "image") {
71
+            } else if ($type == "image") {
72 72
               echo "<img style='max-width: 100%;' src='/images/" . $filename . "'>";
73
-            } else if($type == "midi") {
73
+            } else if ($type == "midi") {
74 74
                 echo "Note: It may take a few seconds for the MIDI to load.<br>";
75 75
                 echo "<a href='#' onClick=\"MIDIjs.play('/midis/" . $filename . "');\">Play " . $title . "</a>";
76 76
                 echo "<br><a href='#' onClick='MIDIjs.stop();'>Stop MIDI Playback</a>";
77
-            } else if($type == "chiptune") {
77
+            } else if ($type == "chiptune") {
78 78
                 //the way i did this absolutely sucks and im
79 79
                 echo '<script type="text/javascript">
80 80
                 window["libopenmpt"] = {};
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             <script type="text/javascript" src="//cdn.jsdelivr.net/gh/deskjet/chiptune2.js@master/libopenmpt.js"></script>
202 202
             <script type="text/javascript" src="//cdn.jsdelivr.net/gh/deskjet/chiptune2.js@master/chiptune2.js"></script>';
203 203
             echo '<a class="song" data-modurl="/midis/' . $filename . '" href="#">Play ' . $title . '</a>';
204
-            } else if($type == "news" || $type == "review") {
204
+            } else if ($type == "news" || $type == "review") {
205 205
               //do nothing
206
-            } else if($type == "video") {
206
+            } else if ($type == "video") {
207 207
               echo ' <video width="640" height="400" controls>
208 208
                   <source src="/videos/' . $filename . '" type="video/mp4">
209 209
                 </video> ';
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
                 $result = $stmt->get_result();
224 224
             ?>
225 225
             <div class="commentsList">
226
-                <?php while($row = $result->fetch_assoc()) { ?>
226
+                <?php while ($row = $result->fetch_assoc()) { ?>
227 227
                 <div class='commentRight' style='display: grid; grid-template-columns: auto 85%; padding:5px;'>
228 228
                     <div>
229 229
                         <a style='float: left;' href='/?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a>
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
                     </div>
233 233
                     <div style="word-wrap: break-word;">
234 234
                         <small><?php echo $row['date']; ?></small>
235
-                        <?php echo validateMarkdown($row['text']);?>
235
+                        <?php echo validateMarkdown($row['text']); ?>
236 236
                     </div>
237 237
                 </div>
238 238
                 <?php } ?>
Please login to merge, or discard this patch.