@@ -1,9 +1,9 @@ |
||
| 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 = 'y' WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |
@@ -12,8 +12,8 @@ discard block |
||
| 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 |
||
| 23 | 23 | echo 'file with the same name already exists<hr>'; |
| 24 | 24 | $uploadOk = 0; |
| 25 | 25 | } |
| 26 | - if($imageFileType != "xm" && $imageFileType != "mod" && $imageFileType != "s3m" && $imageFileType != "it") { |
|
| 26 | + if ($imageFileType != "xm" && $imageFileType != "mod" && $imageFileType != "s3m" && $imageFileType != "it") { |
|
| 27 | 27 | echo 'unsupported file type. must be .xm, .mod, .s3m, or .it<hr>'; |
| 28 | 28 | $uploadOk = 0; |
| 29 | 29 | } |
@@ -12,8 +12,8 @@ |
||
| 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 | |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | if ($_SERVER['REQUEST_METHOD'] == 'GET' && isset($_GET["r_login"])) { |
| 17 | 17 | $error = "The page you tried to access requires you to be logged in."; |
| 18 | 18 | } |
| 19 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 20 | - if(isset($_POST['remember'])) { |
|
| 19 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) { |
|
| 20 | + if (isset($_POST['remember'])) { |
|
| 21 | 21 | $rememberMe = true; |
| 22 | 22 | } else { |
| 23 | 23 | $rememberMe = false; |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | $stmt->bind_param("s", $_POST['username']); |
| 27 | 27 | $stmt->execute(); |
| 28 | 28 | $result = $stmt->get_result(); |
| 29 | - if(!mysqli_num_rows($result)){ { $error = "incorrect username or password"; goto skip; } } |
|
| 29 | + if (!mysqli_num_rows($result)) { { $error = "incorrect username or password"; goto skip; } } |
|
| 30 | 30 | |
| 31 | 31 | $row = $result->fetch_assoc(); |
| 32 | 32 | $hash = $row['password']; |
| 33 | 33 | |
| 34 | - if(!password_verify($_POST['password'], $hash)) { |
|
| 34 | + if (!password_verify($_POST['password'], $hash)) { |
|
| 35 | 35 | $error = "incorrect username or password"; goto skip; |
| 36 | 36 | } |
| 37 | 37 | |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | if (isset($result['otpsecret'])) { |
| 43 | 43 | $otp = true; |
| 44 | 44 | if (isset($_POST['totp'])) { |
| 45 | - if ($_POST['totp'] === $result['otpbackupcode']) {goto skip2fa;} |
|
| 45 | + if ($_POST['totp'] === $result['otpbackupcode']) {goto skip2fa; } |
|
| 46 | 46 | require("vendor/autoload.php"); |
| 47 | 47 | $totp = OTPHP\TOTP::create($result['otpsecret']); |
| 48 | 48 | if (!$totp->verify($_POST['totp'])) { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | skip2fa: |
| 58 | 58 | |
| 59 | - if($rememberMe) { |
|
| 59 | + if ($rememberMe) { |
|
| 60 | 60 | session_write_close(); |
| 61 | 61 | session_set_cookie_params("2678400"); |
| 62 | 62 | ini_set('session.gc_maxlifetime', 2678400); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | } |
| 71 | 71 | skip: |
| 72 | 72 | |
| 73 | - if(isset($error)) { echo "<small style='color:red'>".$error."</small>"; } |
|
| 73 | + if (isset($error)) { echo "<small style='color:red'>" . $error . "</small>"; } |
|
| 74 | 74 | ?> |
| 75 | 75 | <form method="post"> |
| 76 | 76 | <input required placeholder="Username" type="text" name="username"><br> |
@@ -11,133 +11,133 @@ |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | function validateCSS($validate) { |
| 14 | - $DISALLOWED = array("<?php", "?>", "behavior: url", ".php", "@import", "@\import", "@/import"); |
|
| 14 | + $DISALLOWED = array("<?php", "?>", "behavior: url", ".php", "@import", "@\import", "@/import"); |
|
| 15 | 15 | |
| 16 | - $validated = str_replace($DISALLOWED, "", $validate); |
|
| 16 | + $validated = str_replace($DISALLOWED, "", $validate); |
|
| 17 | 17 | return $validated; |
| 18 | 18 | } |
| 19 | 19 | function validateMarkdown($comment) { |
| 20 | - $markdown = new Michelf\Markdown; |
|
| 21 | - $markdown->no_markup = true; |
|
| 22 | - $transformed = $markdown->transform($comment); |
|
| 23 | - return preg_replace( |
|
| 24 | - "/<a href=(?:'|\")javascript:(.*?)(?:'|\")>(.*?)<\/a>/i", |
|
| 25 | - "Attempted XSS: $2 ($1)", |
|
| 26 | - $transformed |
|
| 27 | - ); |
|
| 20 | + $markdown = new Michelf\Markdown; |
|
| 21 | + $markdown->no_markup = true; |
|
| 22 | + $transformed = $markdown->transform($comment); |
|
| 23 | + return preg_replace( |
|
| 24 | + "/<a href=(?:'|\")javascript:(.*?)(?:'|\")>(.*?)<\/a>/i", |
|
| 25 | + "Attempted XSS: $2 ($1)", |
|
| 26 | + $transformed |
|
| 27 | + ); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | function validateCaptcha($privatekey, $response) { |
| 31 | - $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response)); |
|
| 32 | - return $responseData->success; |
|
| 31 | + $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response)); |
|
| 32 | + return $responseData->success; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | function requireLogin() { |
| 36 | - if (!isset($_SESSION['user'])) { |
|
| 37 | - header("Location: /login.php?r_login"); die(); |
|
| 38 | - } |
|
| 36 | + if (!isset($_SESSION['user'])) { |
|
| 37 | + header("Location: /login.php?r_login"); die(); |
|
| 38 | + } |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | function getID($user, $connection) { |
| 42 | - $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?"); |
|
| 43 | - $stmt->bind_param("s", $user); |
|
| 44 | - $stmt->execute(); |
|
| 45 | - $result = $stmt->get_result(); |
|
| 46 | - if($result->num_rows === 0) return 'error'; |
|
| 47 | - while($row = $result->fetch_assoc()) { |
|
| 48 | - $id = $row['id']; |
|
| 49 | - } |
|
| 50 | - $stmt->close(); |
|
| 51 | - return $id; |
|
| 42 | + $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?"); |
|
| 43 | + $stmt->bind_param("s", $user); |
|
| 44 | + $stmt->execute(); |
|
| 45 | + $result = $stmt->get_result(); |
|
| 46 | + if($result->num_rows === 0) return 'error'; |
|
| 47 | + while($row = $result->fetch_assoc()) { |
|
| 48 | + $id = $row['id']; |
|
| 49 | + } |
|
| 50 | + $stmt->close(); |
|
| 51 | + return $id; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | function getName($id, $connection) { |
| 55 | - $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?"); |
|
| 56 | - $stmt->bind_param("s", $id); |
|
| 57 | - $stmt->execute(); |
|
| 58 | - $result = $stmt->get_result(); |
|
| 59 | - if($result->num_rows === 0) return('error'); |
|
| 60 | - while($row = $result->fetch_assoc()) { |
|
| 61 | - $name = htmlspecialchars($row['username']); |
|
| 62 | - } |
|
| 63 | - $stmt->close(); |
|
| 64 | - return $name; |
|
| 55 | + $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?"); |
|
| 56 | + $stmt->bind_param("s", $id); |
|
| 57 | + $stmt->execute(); |
|
| 58 | + $result = $stmt->get_result(); |
|
| 59 | + if($result->num_rows === 0) return('error'); |
|
| 60 | + while($row = $result->fetch_assoc()) { |
|
| 61 | + $name = htmlspecialchars($row['username']); |
|
| 62 | + } |
|
| 63 | + $stmt->close(); |
|
| 64 | + return $name; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | function getPFP($user, $connection) { |
| 68 | - $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?"); |
|
| 69 | - $stmt->bind_param("s", $user); |
|
| 70 | - $stmt->execute(); |
|
| 71 | - $result = $stmt->get_result(); |
|
| 72 | - if($result->num_rows === 0) return('error'); |
|
| 73 | - while($row = $result->fetch_assoc()) { |
|
| 74 | - $pfp = htmlspecialchars($row['pfp']); |
|
| 75 | - } |
|
| 76 | - $stmt->close(); |
|
| 77 | - return $pfp; |
|
| 68 | + $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?"); |
|
| 69 | + $stmt->bind_param("s", $user); |
|
| 70 | + $stmt->execute(); |
|
| 71 | + $result = $stmt->get_result(); |
|
| 72 | + if($result->num_rows === 0) return('error'); |
|
| 73 | + while($row = $result->fetch_assoc()) { |
|
| 74 | + $pfp = htmlspecialchars($row['pfp']); |
|
| 75 | + } |
|
| 76 | + $stmt->close(); |
|
| 77 | + return $pfp; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | function checkIfFriended($friend1, $friend2, $connection) |
| 81 | 81 | { |
| 82 | - $stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?"); |
|
| 83 | - $stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1); |
|
| 84 | - $stmt->execute(); |
|
| 85 | - $result = $stmt->get_result(); |
|
| 86 | - if($result->num_rows === 1){ return true; } |
|
| 87 | - return false; |
|
| 82 | + $stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?"); |
|
| 83 | + $stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1); |
|
| 84 | + $stmt->execute(); |
|
| 85 | + $result = $stmt->get_result(); |
|
| 86 | + if($result->num_rows === 1){ return true; } |
|
| 87 | + return false; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | function getUser($id, $connection) { |
| 91 | - $userResult = array(); |
|
| 92 | - $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?"); |
|
| 93 | - $stmt->bind_param("i", $id); |
|
| 94 | - $stmt->execute(); |
|
| 95 | - $result = $stmt->get_result(); |
|
| 96 | - if($result->num_rows === 0) echo('That user does not exist.'); |
|
| 97 | - while($row = $result->fetch_assoc()) { |
|
| 98 | - $userResult['username'] = $row['username']; |
|
| 99 | - $userResult['id'] = $row['id']; |
|
| 100 | - $userResult['date'] = $row['date']; |
|
| 101 | - $userResult['bio'] = $row['bio']; |
|
| 102 | - $userResult['css'] = $row['css']; |
|
| 103 | - $userResult['pfp'] = $row['pfp']; |
|
| 104 | - $userResult['badges'] = explode(';', $row['badges']); |
|
| 105 | - $userResult['music'] = $row['music']; |
|
| 106 | - } |
|
| 107 | - $stmt->close(); |
|
| 108 | - |
|
| 109 | - $stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?"); |
|
| 110 | - $stmt->bind_param("s", $userResult['username']); |
|
| 111 | - $stmt->execute(); |
|
| 112 | - $result = $stmt->get_result(); |
|
| 113 | - |
|
| 114 | - $userResult['comments'] = 0; |
|
| 115 | - while($row = $result->fetch_assoc()) { |
|
| 116 | - $userResult['comments']++; |
|
| 117 | - } |
|
| 118 | - $stmt->close(); |
|
| 119 | - |
|
| 120 | - $stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?"); |
|
| 121 | - $stmt->bind_param("s", $userResult['username']); |
|
| 122 | - $stmt->execute(); |
|
| 123 | - $result = $stmt->get_result(); |
|
| 124 | - |
|
| 125 | - $userResult['profilecomments'] = 0; |
|
| 126 | - while($row = $result->fetch_assoc()) { |
|
| 127 | - $userResult['profilecomments']++; |
|
| 128 | - } |
|
| 129 | - $stmt->close(); |
|
| 130 | - |
|
| 131 | - $stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'"); |
|
| 132 | - $stmt->bind_param("s", $userResult['username']); |
|
| 133 | - $stmt->execute(); |
|
| 134 | - $result = $stmt->get_result(); |
|
| 135 | - |
|
| 136 | - $userResult['filesuploaded'] = 0; |
|
| 137 | - while($row = $result->fetch_assoc()) { |
|
| 138 | - $userResult['filesuploaded']++; |
|
| 139 | - } |
|
| 140 | - $stmt->close(); |
|
| 141 | - return $userResult; |
|
| 91 | + $userResult = array(); |
|
| 92 | + $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?"); |
|
| 93 | + $stmt->bind_param("i", $id); |
|
| 94 | + $stmt->execute(); |
|
| 95 | + $result = $stmt->get_result(); |
|
| 96 | + if($result->num_rows === 0) echo('That user does not exist.'); |
|
| 97 | + while($row = $result->fetch_assoc()) { |
|
| 98 | + $userResult['username'] = $row['username']; |
|
| 99 | + $userResult['id'] = $row['id']; |
|
| 100 | + $userResult['date'] = $row['date']; |
|
| 101 | + $userResult['bio'] = $row['bio']; |
|
| 102 | + $userResult['css'] = $row['css']; |
|
| 103 | + $userResult['pfp'] = $row['pfp']; |
|
| 104 | + $userResult['badges'] = explode(';', $row['badges']); |
|
| 105 | + $userResult['music'] = $row['music']; |
|
| 106 | + } |
|
| 107 | + $stmt->close(); |
|
| 108 | + |
|
| 109 | + $stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?"); |
|
| 110 | + $stmt->bind_param("s", $userResult['username']); |
|
| 111 | + $stmt->execute(); |
|
| 112 | + $result = $stmt->get_result(); |
|
| 113 | + |
|
| 114 | + $userResult['comments'] = 0; |
|
| 115 | + while($row = $result->fetch_assoc()) { |
|
| 116 | + $userResult['comments']++; |
|
| 117 | + } |
|
| 118 | + $stmt->close(); |
|
| 119 | + |
|
| 120 | + $stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?"); |
|
| 121 | + $stmt->bind_param("s", $userResult['username']); |
|
| 122 | + $stmt->execute(); |
|
| 123 | + $result = $stmt->get_result(); |
|
| 124 | + |
|
| 125 | + $userResult['profilecomments'] = 0; |
|
| 126 | + while($row = $result->fetch_assoc()) { |
|
| 127 | + $userResult['profilecomments']++; |
|
| 128 | + } |
|
| 129 | + $stmt->close(); |
|
| 130 | + |
|
| 131 | + $stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'"); |
|
| 132 | + $stmt->bind_param("s", $userResult['username']); |
|
| 133 | + $stmt->execute(); |
|
| 134 | + $result = $stmt->get_result(); |
|
| 135 | + |
|
| 136 | + $userResult['filesuploaded'] = 0; |
|
| 137 | + while($row = $result->fetch_assoc()) { |
|
| 138 | + $userResult['filesuploaded']++; |
|
| 139 | + } |
|
| 140 | + $stmt->close(); |
|
| 141 | + return $userResult; |
|
| 142 | 142 | } |
| 143 | 143 | ?> |
| 144 | 144 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | define("DEBUG_MODE", true); |
| 6 | 6 | session_start(); |
| 7 | -if(defined("DEBUG_MODE") && DEBUG_MODE) { |
|
| 7 | +if (defined("DEBUG_MODE") && DEBUG_MODE) { |
|
| 8 | 8 | ini_set('display_errors', 1); |
| 9 | 9 | ini_set('display_startup_errors', 1); |
| 10 | 10 | error_reporting(E_ALL); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | function validateCaptcha($privatekey, $response) { |
| 31 | - $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response)); |
|
| 31 | + $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . $privatekey . '&response=' . $response)); |
|
| 32 | 32 | return $responseData->success; |
| 33 | 33 | } |
| 34 | 34 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | $stmt->bind_param("s", $user); |
| 44 | 44 | $stmt->execute(); |
| 45 | 45 | $result = $stmt->get_result(); |
| 46 | - if($result->num_rows === 0) return 'error'; |
|
| 47 | - while($row = $result->fetch_assoc()) { |
|
| 46 | + if ($result->num_rows === 0) return 'error'; |
|
| 47 | + while ($row = $result->fetch_assoc()) { |
|
| 48 | 48 | $id = $row['id']; |
| 49 | 49 | } |
| 50 | 50 | $stmt->close(); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | $stmt->bind_param("s", $id); |
| 57 | 57 | $stmt->execute(); |
| 58 | 58 | $result = $stmt->get_result(); |
| 59 | - if($result->num_rows === 0) return('error'); |
|
| 60 | - while($row = $result->fetch_assoc()) { |
|
| 59 | + if ($result->num_rows === 0) return('error'); |
|
| 60 | + while ($row = $result->fetch_assoc()) { |
|
| 61 | 61 | $name = htmlspecialchars($row['username']); |
| 62 | 62 | } |
| 63 | 63 | $stmt->close(); |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | $stmt->bind_param("s", $user); |
| 70 | 70 | $stmt->execute(); |
| 71 | 71 | $result = $stmt->get_result(); |
| 72 | - if($result->num_rows === 0) return('error'); |
|
| 73 | - while($row = $result->fetch_assoc()) { |
|
| 72 | + if ($result->num_rows === 0) return('error'); |
|
| 73 | + while ($row = $result->fetch_assoc()) { |
|
| 74 | 74 | $pfp = htmlspecialchars($row['pfp']); |
| 75 | 75 | } |
| 76 | 76 | $stmt->close(); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1); |
| 84 | 84 | $stmt->execute(); |
| 85 | 85 | $result = $stmt->get_result(); |
| 86 | - if($result->num_rows === 1){ return true; } |
|
| 86 | + if ($result->num_rows === 1) { return true; } |
|
| 87 | 87 | return false; |
| 88 | 88 | } |
| 89 | 89 | |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | $stmt->bind_param("i", $id); |
| 94 | 94 | $stmt->execute(); |
| 95 | 95 | $result = $stmt->get_result(); |
| 96 | - if($result->num_rows === 0) echo('That user does not exist.'); |
|
| 97 | - while($row = $result->fetch_assoc()) { |
|
| 96 | + if ($result->num_rows === 0) echo('That user does not exist.'); |
|
| 97 | + while ($row = $result->fetch_assoc()) { |
|
| 98 | 98 | $userResult['username'] = $row['username']; |
| 99 | 99 | $userResult['id'] = $row['id']; |
| 100 | 100 | $userResult['date'] = $row['date']; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $result = $stmt->get_result(); |
| 113 | 113 | |
| 114 | 114 | $userResult['comments'] = 0; |
| 115 | - while($row = $result->fetch_assoc()) { |
|
| 115 | + while ($row = $result->fetch_assoc()) { |
|
| 116 | 116 | $userResult['comments']++; |
| 117 | 117 | } |
| 118 | 118 | $stmt->close(); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $result = $stmt->get_result(); |
| 124 | 124 | |
| 125 | 125 | $userResult['profilecomments'] = 0; |
| 126 | - while($row = $result->fetch_assoc()) { |
|
| 126 | + while ($row = $result->fetch_assoc()) { |
|
| 127 | 127 | $userResult['profilecomments']++; |
| 128 | 128 | } |
| 129 | 129 | $stmt->close(); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $result = $stmt->get_result(); |
| 135 | 135 | |
| 136 | 136 | $userResult['filesuploaded'] = 0; |
| 137 | - while($row = $result->fetch_assoc()) { |
|
| 137 | + while ($row = $result->fetch_assoc()) { |
|
| 138 | 138 | $userResult['filesuploaded']++; |
| 139 | 139 | } |
| 140 | 140 | $stmt->close(); |
@@ -43,7 +43,9 @@ discard block |
||
| 43 | 43 | $stmt->bind_param("s", $user); |
| 44 | 44 | $stmt->execute(); |
| 45 | 45 | $result = $stmt->get_result(); |
| 46 | - if($result->num_rows === 0) return 'error'; |
|
| 46 | + if($result->num_rows === 0) { |
|
| 47 | + return 'error'; |
|
| 48 | + } |
|
| 47 | 49 | while($row = $result->fetch_assoc()) { |
| 48 | 50 | $id = $row['id']; |
| 49 | 51 | } |
@@ -56,7 +58,9 @@ discard block |
||
| 56 | 58 | $stmt->bind_param("s", $id); |
| 57 | 59 | $stmt->execute(); |
| 58 | 60 | $result = $stmt->get_result(); |
| 59 | - if($result->num_rows === 0) return('error'); |
|
| 61 | + if($result->num_rows === 0) { |
|
| 62 | + return('error'); |
|
| 63 | + } |
|
| 60 | 64 | while($row = $result->fetch_assoc()) { |
| 61 | 65 | $name = htmlspecialchars($row['username']); |
| 62 | 66 | } |
@@ -69,7 +73,9 @@ discard block |
||
| 69 | 73 | $stmt->bind_param("s", $user); |
| 70 | 74 | $stmt->execute(); |
| 71 | 75 | $result = $stmt->get_result(); |
| 72 | - if($result->num_rows === 0) return('error'); |
|
| 76 | + if($result->num_rows === 0) { |
|
| 77 | + return('error'); |
|
| 78 | + } |
|
| 73 | 79 | while($row = $result->fetch_assoc()) { |
| 74 | 80 | $pfp = htmlspecialchars($row['pfp']); |
| 75 | 81 | } |
@@ -93,7 +99,9 @@ discard block |
||
| 93 | 99 | $stmt->bind_param("i", $id); |
| 94 | 100 | $stmt->execute(); |
| 95 | 101 | $result = $stmt->get_result(); |
| 96 | - if($result->num_rows === 0) echo('That user does not exist.'); |
|
| 102 | + if($result->num_rows === 0) { |
|
| 103 | + echo('That user does not exist.'); |
|
| 104 | + } |
|
| 97 | 105 | while($row = $result->fetch_assoc()) { |
| 98 | 106 | $userResult['username'] = $row['username']; |
| 99 | 107 | $userResult['id'] = $row['id']; |
@@ -18,32 +18,32 @@ discard block |
||
| 18 | 18 | ?> |
| 19 | 19 | <center><h1 style="display: inline-block;">4Grounds - Register</h1><br> |
| 20 | 20 | <?php |
| 21 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) |
|
| 21 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) |
|
| 22 | 22 | { |
| 23 | 23 | $email = htmlspecialchars(@$_POST['email']); |
| 24 | 24 | $username = htmlspecialchars(@$_POST['username']); |
| 25 | 25 | $password = @$_POST['password']; |
| 26 | 26 | $passwordhash = password_hash(@$password, PASSWORD_DEFAULT); |
| 27 | 27 | |
| 28 | - if($_POST['password'] !== $_POST['confirm']){ $error = "password and confirmation password do not match"; goto skip; } |
|
| 28 | + if ($_POST['password'] !== $_POST['confirm']) { $error = "password and confirmation password do not match"; goto skip; } |
|
| 29 | 29 | |
| 30 | - if(strlen($username) > 21) { $error = "your username must be shorter than 21 characters"; goto skip; } |
|
| 31 | - if(strlen($password) < 8) { $error = "your password must be at least 8 characters long"; goto skip; } |
|
| 32 | - if(!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $password)) { $error = "please include both letters and numbers in your password"; goto skip; } |
|
| 33 | - if(!isset($_POST['g-recaptcha-response'])){ $error = "captcha validation failed"; goto skip; } |
|
| 34 | - if($config['use_recaptcha'] && !validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 30 | + if (strlen($username) > 21) { $error = "your username must be shorter than 21 characters"; goto skip; } |
|
| 31 | + if (strlen($password) < 8) { $error = "your password must be at least 8 characters long"; goto skip; } |
|
| 32 | + if (!preg_match('/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/', $password)) { $error = "please include both letters and numbers in your password"; goto skip; } |
|
| 33 | + if (!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 34 | + if ($config['use_recaptcha'] && !validateCaptcha($config['recaptcha_secret'], $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 35 | 35 | |
| 36 | 36 | $stmt = $conn->prepare("SELECT username FROM users WHERE username = ?"); |
| 37 | 37 | $stmt->bind_param("s", $username); |
| 38 | 38 | $stmt->execute(); |
| 39 | 39 | $result = $stmt->get_result(); |
| 40 | - if($result->num_rows) { $error = "there's already a user with that same name!"; goto skip; } |
|
| 40 | + if ($result->num_rows) { $error = "there's already a user with that same name!"; goto skip; } |
|
| 41 | 41 | |
| 42 | 42 | $stmt = $conn->prepare("SELECT email FROM users WHERE email = ?"); |
| 43 | 43 | $stmt->bind_param("s", $email); |
| 44 | 44 | $stmt->execute(); |
| 45 | 45 | $result = $stmt->get_result(); |
| 46 | - if($result->num_rows) { $error = "there's already a user with that same email!"; goto skip; } |
|
| 46 | + if ($result->num_rows) { $error = "there's already a user with that same email!"; goto skip; } |
|
| 47 | 47 | |
| 48 | 48 | //TODO: add cloudflare ip thing |
| 49 | 49 | $stmt = $conn->prepare("INSERT INTO `users` (`username`, `email`, `password`) VALUES (?, ?, ?)"); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | skip: |
| 65 | 65 | |
| 66 | - if(isset($error)) { echo "<small style='color:red'>".$error."</small>"; } ?> |
|
| 66 | + if (isset($error)) { echo "<small style='color:red'>" . $error . "</small>"; } ?> |
|
| 67 | 67 | <form method="post"> |
| 68 | 68 | <input required placeholder="Username" type="text" name="username"><br> |
| 69 | 69 | <input required placeholder="E-Mail" type="email" name="email"><br><br> |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | <body> |
| 15 | 15 | <?php |
| 16 | 16 | require(__DIR__ . "/important/header.php"); |
| 17 | - ?> |
|
| 17 | + ?> |
|
| 18 | 18 | <center><h1 style="display: inline-block;">4Grounds - Register</h1><br> |
| 19 | 19 | <?php |
| 20 | 20 | if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) |
@@ -18,8 +18,8 @@ |
||
| 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='/view/group?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>" . $row['title'] . "</a></i></span><br> |
@@ -18,7 +18,9 @@ |
||
| 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> |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | <source src="/musicfiles/' . $filename . '"> |
| 70 | 70 | </audio>'; |
| 71 | 71 | } else if($type == "image") { |
| 72 | - echo "<img style='max-width: 100%;' src='/images/" . $filename . "'>"; |
|
| 72 | + echo "<img style='max-width: 100%;' src='/images/" . $filename . "'>"; |
|
| 73 | 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>"; |
@@ -202,9 +202,9 @@ discard block |
||
| 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 | 204 | } else if($type == "news" || $type == "review") { |
| 205 | - //do nothing |
|
| 205 | + //do nothing |
|
| 206 | 206 | } else if($type == "video") { |
| 207 | - echo ' <video width="640" height="400" controls> |
|
| 207 | + echo ' <video width="640" height="400" controls> |
|
| 208 | 208 | <source src="/videos/' . $filename . '" type="video/mp4"> |
| 209 | 209 | </video> '; |
| 210 | 210 | } else { |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | <form method="post" enctype="multipart/form-data" id="submitform"> |
| 216 | 216 | <textarea required cols="77" placeholder="Comment" name="comment"></textarea><br> |
| 217 | 217 | <input type="submit" value="Post" <?php |
| 218 | - if ($config['use_recaptcha']) |
|
| 218 | + if ($config['use_recaptcha']) |
|
| 219 | 219 | echo 'class="g-recaptcha" data-sitekey="' . $config['recaptcha_sitekey'] . '" data-callback="onSubmit"' |
| 220 | 220 | ?>> <small>max limit: 500 characters | supports <a href="https://www.markdownguide.org/basic-syntax">Markdown</a></small> |
| 221 | 221 | </form> |
@@ -12,7 +12,9 @@ discard block |
||
| 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.'); |
|
| 15 | + if($result->num_rows === 0) { |
|
| 16 | + echo('There are no users.'); |
|
| 17 | + } |
|
| 16 | 18 | while($row = $result->fetch_assoc()) { |
| 17 | 19 | $author = $row['author']; |
| 18 | 20 | $id = $row['id']; |
@@ -215,12 +217,13 @@ discard block |
||
| 215 | 217 | <form method="post" enctype="multipart/form-data" id="submitform"> |
| 216 | 218 | <textarea required cols="77" placeholder="Comment" name="comment"></textarea><br> |
| 217 | 219 | <input type="submit" value="Post" <?php |
| 218 | - if ($config['use_recaptcha']) |
|
| 219 | - echo 'class="g-recaptcha" data-sitekey="' . $config['recaptcha_sitekey'] . '" data-callback="onSubmit"' |
|
| 220 | + if ($config['use_recaptcha']) { |
|
| 221 | + echo 'class="g-recaptcha" data-sitekey="' . $config['recaptcha_sitekey'] . '" data-callback="onSubmit"' |
|
| 220 | 222 | ?>> <small>max limit: 500 characters | supports <a href="https://www.markdownguide.org/basic-syntax">Markdown</a></small> |
| 221 | 223 | </form> |
| 222 | 224 | <?php |
| 223 | 225 | $stmt = $conn->prepare("SELECT * FROM `gamecomments` WHERE toid = ? ORDER BY id DESC"); |
| 226 | + } |
|
| 224 | 227 | $stmt->bind_param("s", $_GET['id']); |
| 225 | 228 | $stmt->execute(); |
| 226 | 229 | $result = $stmt->get_result(); |
@@ -7,13 +7,13 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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($config['use_recaptcha'] && !validateCaptcha($config['recaptcha_secret'], $_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 ($config['use_recaptcha'] && !validateCaptcha($config['recaptcha_secret'], $_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 |
||
| 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 |
||
| 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 |
||
| 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> '; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $result = $stmt->get_result(); |
| 227 | 227 | ?> |
| 228 | 228 | <div class="commentsList"> |
| 229 | - <?php while($row = $result->fetch_assoc()) { ?> |
|
| 229 | + <?php while ($row = $result->fetch_assoc()) { ?> |
|
| 230 | 230 | <div class='commentRight' style='display: grid; grid-template-columns: auto 85%; padding:5px;'> |
| 231 | 231 | <div> |
| 232 | 232 | <a style='float: left;' href='/?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a> |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | </div> |
| 236 | 236 | <div style="word-wrap: break-word;"> |
| 237 | 237 | <small><?php echo $row['date']; ?></small> |
| 238 | - <?php echo validateMarkdown($row['text']);?> |
|
| 238 | + <?php echo validateMarkdown($row['text']); ?> |
|
| 239 | 239 | </div> |
| 240 | 240 | </div> |
| 241 | 241 | <?php } ?> |
@@ -21,16 +21,16 @@ discard block |
||
| 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 |
||
| 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='/?id=<?php echo getID($row["author"], $conn);?>'> |
|
| 65 | - <?php echo $row['author'];?> |
|
| 64 | + <a href='/?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 |
||
| 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 |
||
| 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 |
||
| 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='/?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a> |
@@ -125,7 +125,7 @@ discard block |
||
| 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 |
||
| 134 | 134 | |
| 135 | 135 | echo "<ul>"; |
| 136 | 136 | while ($row = $result->fetch_assoc()) { |
| 137 | - echo "<li><a href='/?id=" . $row['id'] . "'>". $row['username'] . "</a></li>"; |
|
| 137 | + echo "<li><a href='/?id=" . $row['id'] . "'>" . $row['username'] . "</a></li>"; |
|
| 138 | 138 | } |
| 139 | 139 | echo "</ul>"; |
| 140 | 140 | ?> |
@@ -50,7 +50,9 @@ discard block |
||
| 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 |
||
| 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++; |