@@ -8,13 +8,13 @@ discard block |
||
| 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 files 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.'); |
|
| 17 | - while($row = $result->fetch_assoc()) { |
|
| 16 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 17 | + while ($row = $result->fetch_assoc()) { |
|
| 18 | 18 | $author = $row['author']; |
| 19 | 19 | $id = $row['id']; |
| 20 | 20 | $date = $row['date']; |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $status = $row['status']; |
| 25 | 25 | $filename = $row['filename']; |
| 26 | 26 | |
| 27 | - if($status != "y") { |
|
| 27 | + if ($status != "y") { |
|
| 28 | 28 | die("Item is not approved yet."); |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -38,13 +38,13 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | <div class="container"> |
| 40 | 40 | <?php |
| 41 | - if($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 41 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 42 | 42 | { |
| 43 | - if(!isset($_SESSION['user'])){ $error = "you are not logged in"; goto skipcomment; } |
|
| 44 | - if(!$_POST['comment']){ $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 45 | - if(strlen($_POST['comment']) > 500){ $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 46 | - if(!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; } |
|
| 47 | - if($config['use_recaptcha'] && !validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; } |
|
| 43 | + if (!isset($_SESSION['user'])) { $error = "you are not logged in"; goto skipcomment; } |
|
| 44 | + if (!$_POST['comment']) { $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 45 | + if (strlen($_POST['comment']) > 500) { $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 46 | + if (!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; } |
|
| 47 | + if ($config['use_recaptcha'] && !validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skipcomment; } |
|
| 48 | 48 | |
| 49 | 49 | $stmt = $conn->prepare("INSERT INTO `gamecomments` (toid, author, text, date) VALUES (?, ?, ?, now())"); |
| 50 | 50 | $stmt->bind_param("sss", $_GET['id'], $_SESSION['user'], $text); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $stmt->close(); |
| 54 | 54 | } |
| 55 | 55 | skipcomment: |
| 56 | - if(isset($error)) { |
|
| 56 | + if (isset($error)) { |
|
| 57 | 57 | echo "<span style='color: red;'><small>" . $error . "</small></span><br>"; |
| 58 | 58 | } |
| 59 | 59 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | <br><br>" . $extrainfo . "</small><hr>"; |
| 66 | 66 | ?> |
| 67 | 67 | <?php |
| 68 | - switch($type) { |
|
| 68 | + switch ($type) { |
|
| 69 | 69 | case "song": |
| 70 | 70 | echo '<audio controls> <source src="/dynamic/song/' . $filename . '"> </audio>'; |
| 71 | 71 | break; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $result = $stmt->get_result(); |
| 108 | 108 | ?> |
| 109 | 109 | <div class="commentsList"> |
| 110 | - <?php while($row = $result->fetch_assoc()) { ?> |
|
| 110 | + <?php while ($row = $result->fetch_assoc()) { ?> |
|
| 111 | 111 | <div class='commentRight' style='display: grid; grid-template-columns: auto 85%; padding:5px;'> |
| 112 | 112 | <div> |
| 113 | 113 | <a style='float: left;' href='/view/profile?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a> |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | </div> |
| 117 | 117 | <div style="word-wrap: break-word;"> |
| 118 | 118 | <small><?php echo $row['date']; ?></small><br> |
| 119 | - <?php echo validateMarkdown($row['text']);?> |
|
| 119 | + <?php echo validateMarkdown($row['text']); ?> |
|
| 120 | 120 | </div> |
| 121 | 121 | </div> |
| 122 | 122 | <?php } ?> |