@@ -12,35 +12,35 @@ discard block |
||
| 12 | 12 | <link rel="stylesheet" href="/css/header.css"> |
| 13 | 13 | </head> |
| 14 | 14 | <body> |
| 15 | - <?php require(__DIR__ . "/important/header.php"); ?> |
|
| 15 | + <?php require(__DIR__ . "/important/header.php"); ?> |
|
| 16 | 16 | <center><h1 style="display: inline-block;">4Grounds - Register</h1><br> |
| 17 | 17 | <?php |
| 18 | - if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) |
|
| 18 | + if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) |
|
| 19 | 19 | { |
| 20 | 20 | $email = htmlspecialchars(@$_POST['email']); |
| 21 | 21 | $username = htmlspecialchars(@$_POST['username']); |
| 22 | 22 | $password = @$_POST['password']; |
| 23 | 23 | $passwordhash = password_hash(@$password, PASSWORD_DEFAULT); |
| 24 | 24 | |
| 25 | - if($_POST['password'] !== $_POST['confirm']){ $error = "password and confirmation password do not match"; goto skip; } |
|
| 25 | + if ($_POST['password'] !== $_POST['confirm']) { $error = "password and confirmation password do not match"; goto skip; } |
|
| 26 | 26 | |
| 27 | - if(strlen($username) > 21) { $error = "your username must be shorter than 21 characters"; goto skip; } |
|
| 28 | - if(strlen($password) < 8) { $error = "your password must be at least 8 characters long"; goto skip; } |
|
| 29 | - 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; } |
|
| 30 | - if(!isset($_POST['g-recaptcha-response'])){ $error = "captcha validation failed"; goto skip; } |
|
| 31 | - if(!validateCaptcha(CAPTCHA_PRIVATEKEY, $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 27 | + if (strlen($username) > 21) { $error = "your username must be shorter than 21 characters"; goto skip; } |
|
| 28 | + if (strlen($password) < 8) { $error = "your password must be at least 8 characters long"; goto skip; } |
|
| 29 | + 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; } |
|
| 30 | + if (!isset($_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 31 | + if (!validateCaptcha(CAPTCHA_PRIVATEKEY, $_POST['g-recaptcha-response'])) { $error = "captcha validation failed"; goto skip; } |
|
| 32 | 32 | |
| 33 | 33 | $stmt = $conn->prepare("SELECT username FROM users WHERE username = ?"); |
| 34 | 34 | $stmt->bind_param("s", $username); |
| 35 | 35 | $stmt->execute(); |
| 36 | 36 | $result = $stmt->get_result(); |
| 37 | - if($result->num_rows) { $error = "there's already a user with that same name!"; goto skip; } |
|
| 37 | + if ($result->num_rows) { $error = "there's already a user with that same name!"; goto skip; } |
|
| 38 | 38 | |
| 39 | 39 | $stmt = $conn->prepare("SELECT email FROM users WHERE email = ?"); |
| 40 | 40 | $stmt->bind_param("s", $email); |
| 41 | 41 | $stmt->execute(); |
| 42 | 42 | $result = $stmt->get_result(); |
| 43 | - if($result->num_rows) { $error = "there's already a user with that same email!"; goto skip; } |
|
| 43 | + if ($result->num_rows) { $error = "there's already a user with that same email!"; goto skip; } |
|
| 44 | 44 | |
| 45 | 45 | //TODO: add cloudflare ip thing |
| 46 | 46 | $stmt = $conn->prepare("INSERT INTO `users` (`username`, `email`, `password`) VALUES (?, ?, ?)"); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | skip: |
| 62 | 62 | |
| 63 | - if(isset($error)) { echo "<small style='color:red'>".$error."</small>"; } ?> |
|
| 63 | + if (isset($error)) { echo "<small style='color:red'>" . $error . "</small>"; } ?> |
|
| 64 | 64 | <form method="post"> |
| 65 | 65 | <input required placeholder="Username" type="text" name="username"><br> |
| 66 | 66 | <input required placeholder="E-Mail" type="email" name="email"><br><br> |
@@ -44,7 +44,9 @@ discard block |
||
| 44 | 44 | $stmt->bind_param("s", $user); |
| 45 | 45 | $stmt->execute(); |
| 46 | 46 | $result = $stmt->get_result(); |
| 47 | - if($result->num_rows === 0) return 'error'; |
|
| 47 | + if($result->num_rows === 0) { |
|
| 48 | + return 'error'; |
|
| 49 | + } |
|
| 48 | 50 | while($row = $result->fetch_assoc()) { |
| 49 | 51 | $id = $row['id']; |
| 50 | 52 | } |
@@ -57,7 +59,9 @@ discard block |
||
| 57 | 59 | $stmt->bind_param("s", $id); |
| 58 | 60 | $stmt->execute(); |
| 59 | 61 | $result = $stmt->get_result(); |
| 60 | - if($result->num_rows === 0) return('error'); |
|
| 62 | + if($result->num_rows === 0) { |
|
| 63 | + return('error'); |
|
| 64 | + } |
|
| 61 | 65 | while($row = $result->fetch_assoc()) { |
| 62 | 66 | $name = htmlspecialchars($row['username']); |
| 63 | 67 | } |
@@ -70,7 +74,9 @@ discard block |
||
| 70 | 74 | $stmt->bind_param("s", $user); |
| 71 | 75 | $stmt->execute(); |
| 72 | 76 | $result = $stmt->get_result(); |
| 73 | - if($result->num_rows === 0) return('error'); |
|
| 77 | + if($result->num_rows === 0) { |
|
| 78 | + return('error'); |
|
| 79 | + } |
|
| 74 | 80 | while($row = $result->fetch_assoc()) { |
| 75 | 81 | $pfp = htmlspecialchars($row['pfp']); |
| 76 | 82 | } |
@@ -98,7 +104,9 @@ discard block |
||
| 98 | 104 | $stmt->bind_param("i", $id); |
| 99 | 105 | $stmt->execute(); |
| 100 | 106 | $result = $stmt->get_result(); |
| 101 | - if($result->num_rows === 0) echo('That user does not exist.'); |
|
| 107 | + if($result->num_rows === 0) { |
|
| 108 | + echo('That user does not exist.'); |
|
| 109 | + } |
|
| 102 | 110 | while($row = $result->fetch_assoc()) { |
| 103 | 111 | $username = $row['username']; |
| 104 | 112 | $id = $row['id']; |
@@ -12,131 +12,131 @@ |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | function validateCSS($validate) { |
| 15 | - $DISALLOWED = array("<?php", "?>", "behavior: url", ".php", "@import", "@\import", "@/import"); |
|
| 15 | + $DISALLOWED = array("<?php", "?>", "behavior: url", ".php", "@import", "@\import", "@/import"); |
|
| 16 | 16 | |
| 17 | - $validated = str_replace($DISALLOWED, "", $validate); |
|
| 17 | + $validated = str_replace($DISALLOWED, "", $validate); |
|
| 18 | 18 | return $validated; |
| 19 | 19 | } |
| 20 | 20 | function validateMarkdown($comment) { |
| 21 | - $markdown = new Michelf\Markdown; |
|
| 22 | - $markdown->no_markup = true; |
|
| 23 | - $transformed = $markdown->transform($comment); |
|
| 24 | - return preg_replace( |
|
| 25 | - "/<a href=(?:'|\")javascript:(.*?)(?:'|\")>(.*?)<\/a>/i", |
|
| 26 | - "Attempted XSS: $2 ($1)", |
|
| 27 | - $transformed |
|
| 28 | - ); |
|
| 21 | + $markdown = new Michelf\Markdown; |
|
| 22 | + $markdown->no_markup = true; |
|
| 23 | + $transformed = $markdown->transform($comment); |
|
| 24 | + return preg_replace( |
|
| 25 | + "/<a href=(?:'|\")javascript:(.*?)(?:'|\")>(.*?)<\/a>/i", |
|
| 26 | + "Attempted XSS: $2 ($1)", |
|
| 27 | + $transformed |
|
| 28 | + ); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | function validateCaptcha($privatekey, $response) { |
| 32 | - $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response)); |
|
| 33 | - return $responseData->success; |
|
| 32 | + $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response)); |
|
| 33 | + return $responseData->success; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | function requireLogin() { |
| 37 | - if (!isset($_SESSION['user'])) { |
|
| 38 | - header("Location: /login.php?r_login"); die(); |
|
| 39 | - } |
|
| 37 | + if (!isset($_SESSION['user'])) { |
|
| 38 | + header("Location: /login.php?r_login"); die(); |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | function getID($user, $connection) { |
| 43 | - $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?"); |
|
| 44 | - $stmt->bind_param("s", $user); |
|
| 45 | - $stmt->execute(); |
|
| 46 | - $result = $stmt->get_result(); |
|
| 47 | - if($result->num_rows === 0) return 'error'; |
|
| 48 | - while($row = $result->fetch_assoc()) { |
|
| 49 | - $id = $row['id']; |
|
| 50 | - } |
|
| 51 | - $stmt->close(); |
|
| 52 | - return $id; |
|
| 43 | + $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?"); |
|
| 44 | + $stmt->bind_param("s", $user); |
|
| 45 | + $stmt->execute(); |
|
| 46 | + $result = $stmt->get_result(); |
|
| 47 | + if($result->num_rows === 0) return 'error'; |
|
| 48 | + while($row = $result->fetch_assoc()) { |
|
| 49 | + $id = $row['id']; |
|
| 50 | + } |
|
| 51 | + $stmt->close(); |
|
| 52 | + return $id; |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | function getName($id, $connection) { |
| 56 | - $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?"); |
|
| 57 | - $stmt->bind_param("s", $id); |
|
| 58 | - $stmt->execute(); |
|
| 59 | - $result = $stmt->get_result(); |
|
| 60 | - if($result->num_rows === 0) return('error'); |
|
| 61 | - while($row = $result->fetch_assoc()) { |
|
| 62 | - $name = htmlspecialchars($row['username']); |
|
| 63 | - } |
|
| 64 | - $stmt->close(); |
|
| 65 | - return $name; |
|
| 56 | + $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?"); |
|
| 57 | + $stmt->bind_param("s", $id); |
|
| 58 | + $stmt->execute(); |
|
| 59 | + $result = $stmt->get_result(); |
|
| 60 | + if($result->num_rows === 0) return('error'); |
|
| 61 | + while($row = $result->fetch_assoc()) { |
|
| 62 | + $name = htmlspecialchars($row['username']); |
|
| 63 | + } |
|
| 64 | + $stmt->close(); |
|
| 65 | + return $name; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | function getPFP($user, $connection) { |
| 69 | - $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?"); |
|
| 70 | - $stmt->bind_param("s", $user); |
|
| 71 | - $stmt->execute(); |
|
| 72 | - $result = $stmt->get_result(); |
|
| 73 | - if($result->num_rows === 0) return('error'); |
|
| 74 | - while($row = $result->fetch_assoc()) { |
|
| 75 | - $pfp = htmlspecialchars($row['pfp']); |
|
| 76 | - } |
|
| 77 | - $stmt->close(); |
|
| 78 | - return $pfp; |
|
| 69 | + $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?"); |
|
| 70 | + $stmt->bind_param("s", $user); |
|
| 71 | + $stmt->execute(); |
|
| 72 | + $result = $stmt->get_result(); |
|
| 73 | + if($result->num_rows === 0) return('error'); |
|
| 74 | + while($row = $result->fetch_assoc()) { |
|
| 75 | + $pfp = htmlspecialchars($row['pfp']); |
|
| 76 | + } |
|
| 77 | + $stmt->close(); |
|
| 78 | + return $pfp; |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | function checkIfFriended($friend1, $friend2, $connection) |
| 82 | 82 | { |
| 83 | - $stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?"); |
|
| 84 | - $stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1); |
|
| 85 | - $stmt->execute(); |
|
| 86 | - $result = $stmt->get_result(); |
|
| 87 | - if($result->num_rows === 1){ return true; } |
|
| 88 | - return false; |
|
| 83 | + $stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?"); |
|
| 84 | + $stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1); |
|
| 85 | + $stmt->execute(); |
|
| 86 | + $result = $stmt->get_result(); |
|
| 87 | + if($result->num_rows === 1){ return true; } |
|
| 88 | + return false; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | function getUser($id, $connection) { |
| 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 | - $username = $row['username']; |
|
| 99 | - $id = $row['id']; |
|
| 100 | - $date = $row['date']; |
|
| 101 | - $bio = $row['bio']; |
|
| 102 | - $css = $row['css']; |
|
| 103 | - $pfp = $row['pfp']; |
|
| 104 | - $badges = explode(';', $row['badges']); |
|
| 105 | - $music = $row['music']; |
|
| 106 | - } |
|
| 107 | - $stmt->close(); |
|
| 108 | - |
|
| 109 | - $stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?"); |
|
| 110 | - $stmt->bind_param("s", $username); |
|
| 111 | - $stmt->execute(); |
|
| 112 | - $result = $stmt->get_result(); |
|
| 113 | - |
|
| 114 | - $comments = 0; |
|
| 115 | - while($row = $result->fetch_assoc()) { |
|
| 116 | - $comments++; |
|
| 117 | - } |
|
| 118 | - $stmt->close(); |
|
| 119 | - |
|
| 120 | - $stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?"); |
|
| 121 | - $stmt->bind_param("s", $username); |
|
| 122 | - $stmt->execute(); |
|
| 123 | - $result = $stmt->get_result(); |
|
| 124 | - |
|
| 125 | - $profilecomments = 0; |
|
| 126 | - while($row = $result->fetch_assoc()) { |
|
| 127 | - $profilecomments++; |
|
| 128 | - } |
|
| 129 | - $stmt->close(); |
|
| 130 | - |
|
| 131 | - $stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'"); |
|
| 132 | - $stmt->bind_param("s", $username); |
|
| 133 | - $stmt->execute(); |
|
| 134 | - $result = $stmt->get_result(); |
|
| 135 | - |
|
| 136 | - $filesuploaded = 0; |
|
| 137 | - while($row = $result->fetch_assoc()) { |
|
| 138 | - $filesuploaded++; |
|
| 139 | - } |
|
| 140 | - $stmt->close(); |
|
| 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 | + $username = $row['username']; |
|
| 99 | + $id = $row['id']; |
|
| 100 | + $date = $row['date']; |
|
| 101 | + $bio = $row['bio']; |
|
| 102 | + $css = $row['css']; |
|
| 103 | + $pfp = $row['pfp']; |
|
| 104 | + $badges = explode(';', $row['badges']); |
|
| 105 | + $music = $row['music']; |
|
| 106 | + } |
|
| 107 | + $stmt->close(); |
|
| 108 | + |
|
| 109 | + $stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?"); |
|
| 110 | + $stmt->bind_param("s", $username); |
|
| 111 | + $stmt->execute(); |
|
| 112 | + $result = $stmt->get_result(); |
|
| 113 | + |
|
| 114 | + $comments = 0; |
|
| 115 | + while($row = $result->fetch_assoc()) { |
|
| 116 | + $comments++; |
|
| 117 | + } |
|
| 118 | + $stmt->close(); |
|
| 119 | + |
|
| 120 | + $stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?"); |
|
| 121 | + $stmt->bind_param("s", $username); |
|
| 122 | + $stmt->execute(); |
|
| 123 | + $result = $stmt->get_result(); |
|
| 124 | + |
|
| 125 | + $profilecomments = 0; |
|
| 126 | + while($row = $result->fetch_assoc()) { |
|
| 127 | + $profilecomments++; |
|
| 128 | + } |
|
| 129 | + $stmt->close(); |
|
| 130 | + |
|
| 131 | + $stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'"); |
|
| 132 | + $stmt->bind_param("s", $username); |
|
| 133 | + $stmt->execute(); |
|
| 134 | + $result = $stmt->get_result(); |
|
| 135 | + |
|
| 136 | + $filesuploaded = 0; |
|
| 137 | + while($row = $result->fetch_assoc()) { |
|
| 138 | + $filesuploaded++; |
|
| 139 | + } |
|
| 140 | + $stmt->close(); |
|
| 141 | 141 | } |
| 142 | 142 | ?> |
| 143 | 143 | \ 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 | |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | $stmt->bind_param("i", $id); |
| 93 | 93 | $stmt->execute(); |
| 94 | 94 | $result = $stmt->get_result(); |
| 95 | - if($result->num_rows === 0) echo('That user does not exist.'); |
|
| 96 | - while($row = $result->fetch_assoc()) { |
|
| 95 | + if ($result->num_rows === 0) echo('That user does not exist.'); |
|
| 96 | + while ($row = $result->fetch_assoc()) { |
|
| 97 | 97 | $username = $row['username']; |
| 98 | 98 | $id = $row['id']; |
| 99 | 99 | $date = $row['date']; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $result = $stmt->get_result(); |
| 112 | 112 | |
| 113 | 113 | $comments = 0; |
| 114 | - while($row = $result->fetch_assoc()) { |
|
| 114 | + while ($row = $result->fetch_assoc()) { |
|
| 115 | 115 | $comments++; |
| 116 | 116 | } |
| 117 | 117 | $stmt->close(); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $result = $stmt->get_result(); |
| 123 | 123 | |
| 124 | 124 | $profilecomments = 0; |
| 125 | - while($row = $result->fetch_assoc()) { |
|
| 125 | + while ($row = $result->fetch_assoc()) { |
|
| 126 | 126 | $profilecomments++; |
| 127 | 127 | } |
| 128 | 128 | $stmt->close(); |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $result = $stmt->get_result(); |
| 134 | 134 | |
| 135 | 135 | $filesuploaded = 0; |
| 136 | - while($row = $result->fetch_assoc()) { |
|
| 136 | + while ($row = $result->fetch_assoc()) { |
|
| 137 | 137 | $filesuploaded++; |
| 138 | 138 | } |
| 139 | 139 | $stmt->close(); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | require(__DIR__ . "/func/func.php"); |
| 9 | 9 | require(__DIR__ . "/func/conn.php"); |
| 10 | 10 | $featured = array(1, 3, 12); |
| 11 | - $newlines = array("<br>", " <br>", "<br>" , " <br> "); |
|
| 11 | + $newlines = array("<br>", " <br>", "<br>", " <br> "); |
|
| 12 | 12 | ?> |
| 13 | 13 | <title>4Grounds - Hub</title> |
| 14 | 14 | </head> |
@@ -17,27 +17,27 @@ discard block |
||
| 17 | 17 | <div class="container"><br> |
| 18 | 18 | <h1>Search results for type '<?php echo htmlspecialchars($_GET['type']); ?>'</h1> |
| 19 | 19 | <?php |
| 20 | - if(isset($_GET['type'])) { |
|
| 20 | + if (isset($_GET['type'])) { |
|
| 21 | 21 | $stmt = $conn->prepare("SELECT * FROM `files` WHERE type = ? AND status = 'y' ORDER BY id DESC"); |
| 22 | 22 | $stmt->bind_param("s", $_GET['type']); |
| 23 | 23 | $stmt->execute(); |
| 24 | 24 | $result = $stmt->get_result(); |
| 25 | 25 | |
| 26 | - while($row = $result->fetch_assoc()) { |
|
| 27 | - if($row['type'] == "song") { |
|
| 26 | + while ($row = $result->fetch_assoc()) { |
|
| 27 | + if ($row['type'] == "song") { |
|
| 28 | 28 | echo '<b><a href="/view?id=' . $row['id'] . '">' . htmlspecialchars($row['title']) . '</b></a> <span style="float:right;"><small>Uploader: <b>' . $row['author'] . '</b></small></span><br> |
| 29 | 29 | ' . $row['extrainfo'] . '<br> |
| 30 | 30 | <audio controls> |
| 31 | 31 | <source src="/musicfiles/' . $row['filename'] . '"> |
| 32 | 32 | </audio><hr>'; |
| 33 | - } else if($row['type'] == "image") { |
|
| 33 | + } else if ($row['type'] == "image") { |
|
| 34 | 34 | //im sorry for this abomination |
| 35 | 35 | echo "<div style='display: inline-block;' class='notegray'> |
| 36 | 36 | <a href='/view?id=" . $row['id'] . "'><img style='width: 10em;height: 10em;' src='images/" . $row['filename'] . "'> |
| 37 | 37 | <br><center><b>" . htmlspecialchars($row['title']) . "</b><br><span style='color: gray;'>By " . $row['author'] . "</span></center> |
| 38 | 38 | </a> |
| 39 | 39 | </div> "; |
| 40 | - } else if($row['type'] == "news" || $row['type'] == "review") { |
|
| 40 | + } else if ($row['type'] == "news" || $row['type'] == "review") { |
|
| 41 | 41 | echo "<small> |
| 42 | 42 | <img style='position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 43 | 43 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'>[" . $row['agerating'] . "] <i>" . $row['title'] . "</a></i></span><br> |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } else { |
| 48 | 48 | echo "<b><a href='/view?id=" . $row['id'] . "'>" . htmlspecialchars($row['title']) . " by " . $row['author'] . " |
| 49 | 49 | </a><small><span style='float:right;'>[" . $row['date'] . "]</small></span>"; |
| 50 | - if(in_array($row['id'], $featured)) { |
|
| 50 | + if (in_array($row['id'], $featured)) { |
|
| 51 | 51 | echo "<span style='float:right; color: gold;margin-right: 10px;'>Featured!</span> "; |
| 52 | 52 | } |
| 53 | 53 | echo "</b><br>" . $row['extrainfo'] . "<br><hr>"; |
@@ -12,8 +12,8 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require("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 `groups` (title, description, author) VALUES (?, ?, ?)"); |
| 18 | 18 | $stmt->bind_param("sss", $name, $text, $_SESSION['user']); |
| 19 | 19 | $text = htmlspecialchars($_POST['description']); |
@@ -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 users 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.'); // please just refuse to give a user if this is the case |
|
| 17 | - while($row = $result->fetch_assoc()) { // you dont need to use a loop if its only ever gonna return 1 or 0 |
|
| 16 | + if ($result->num_rows !== 0) { // echo('There are no users.'); // please just refuse to give a user if this is the case |
|
| 17 | + while ($row = $result->fetch_assoc()) { // you dont need to use a loop if its only ever gonna return 1 or 0 |
|
| 18 | 18 | $username = $row['username']; // you dont actually need all of these variables oh my god just use an array |
| 19 | 19 | $id = $row['id']; |
| 20 | 20 | $date = $row['date']; |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | $stmt->bind_param("i", $currentgroup); |
| 39 | 39 | $stmt->execute(); |
| 40 | 40 | $result = $stmt->get_result(); |
| 41 | - if($result->num_rows !== 0){ //echo('There are no users.'); // why again |
|
| 42 | - while($row = $result->fetch_assoc()) { |
|
| 41 | + if ($result->num_rows !== 0) { //echo('There are no users.'); // why again |
|
| 42 | + while ($row = $result->fetch_assoc()) { |
|
| 43 | 43 | $grouptitle = $row['title']; |
| 44 | 44 | } |
| 45 | - }else{ |
|
| 45 | + } else { |
|
| 46 | 46 | $grouptitle = "none"; |
| 47 | 47 | } |
| 48 | 48 | $stmt->close(); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $result = $stmt->get_result(); |
| 54 | 54 | |
| 55 | 55 | $comments = 0; |
| 56 | - while($row = $result->fetch_assoc()) { |
|
| 56 | + while ($row = $result->fetch_assoc()) { |
|
| 57 | 57 | $comments++; |
| 58 | 58 | } |
| 59 | 59 | $stmt->close(); |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $result = $stmt->get_result(); |
| 65 | 65 | |
| 66 | 66 | $profilecomments = 0; |
| 67 | - while($row = $result->fetch_assoc()) { |
|
| 67 | + while ($row = $result->fetch_assoc()) { |
|
| 68 | 68 | $profilecomments++; |
| 69 | 69 | } |
| 70 | 70 | $stmt->close(); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $result = $stmt->get_result(); |
| 76 | 76 | |
| 77 | 77 | $filesuploaded = 0; |
| 78 | - while($row = $result->fetch_assoc()) { |
|
| 78 | + while ($row = $result->fetch_assoc()) { |
|
| 79 | 79 | $filesuploaded++; |
| 80 | 80 | } |
| 81 | 81 | $stmt->close(); |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | <div class="container"> |
| 96 | 96 | <br> |
| 97 | 97 | <?php |
| 98 | - if($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 98 | + if ($_SERVER['REQUEST_METHOD'] == 'POST') |
|
| 99 | 99 | { |
| 100 | - if(!isset($_SESSION['user'])){ $error = "you are not logged in"; goto skipcomment; } |
|
| 101 | - if(!$_POST['comment']){ $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 102 | - if(strlen($_POST['comment']) > 500){ $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 100 | + if (!isset($_SESSION['user'])) { $error = "you are not logged in"; goto skipcomment; } |
|
| 101 | + if (!$_POST['comment']) { $error = "your comment cannot be blank"; goto skipcomment; } |
|
| 102 | + if (strlen($_POST['comment']) > 500) { $error = "your comment must be shorter than 500 characters"; goto skipcomment; } |
|
| 103 | 103 | |
| 104 | 104 | $stmt = $conn->prepare("INSERT INTO `comments` (toid, author, text) VALUES (?, ?, ?)"); |
| 105 | 105 | $stmt->bind_param("sss", $_GET['id'], $_SESSION['user'], $text); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | skipcomment: |
| 113 | 113 | |
| 114 | - if(isset($id)) {?> |
|
| 114 | + if (isset($id)) {?> |
|
| 115 | 115 | <div id="groundtext"><center><h1><?php echo $username; ?>'s Ground</h1></center></div> |
| 116 | 116 | <div class="leftHalf"> |
| 117 | 117 | <div class="notegray"> |
@@ -121,12 +121,12 @@ discard block |
||
| 121 | 121 | </center> |
| 122 | 122 | <hr style="border-top: 1px dashed gray;"> |
| 123 | 123 | <div id="userinfo" style="padding-left: 20px;"> |
| 124 | - <span style="color: gold;">Rank:</span> <?php echo $rank;?><br> |
|
| 125 | - <span style="color: gold;">ID:</span> <?php echo $id;?><br> |
|
| 126 | - <span style="color: gold;">Other Comments:</span> <?php echo $comments;?><br> |
|
| 127 | - <span style="color: gold;">Profile Comments:</span> <?php echo $profilecomments;?><br> |
|
| 128 | - <span style="color: gold;">Current Group:</span> <?php echo $grouptitle;?><br> |
|
| 129 | - <span style="color: gold;">Files Uploaded:</span> <?php echo $filesuploaded;?> |
|
| 124 | + <span style="color: gold;">Rank:</span> <?php echo $rank; ?><br> |
|
| 125 | + <span style="color: gold;">ID:</span> <?php echo $id; ?><br> |
|
| 126 | + <span style="color: gold;">Other Comments:</span> <?php echo $comments; ?><br> |
|
| 127 | + <span style="color: gold;">Profile Comments:</span> <?php echo $profilecomments; ?><br> |
|
| 128 | + <span style="color: gold;">Current Group:</span> <?php echo $grouptitle; ?><br> |
|
| 129 | + <span style="color: gold;">Files Uploaded:</span> <?php echo $filesuploaded; ?> |
|
| 130 | 130 | </div><br> |
| 131 | 131 | <?php if (!isset($_GET["ed"])) { ?> |
| 132 | 132 | <audio autoplay controls> |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | </div> |
| 137 | 137 | <br> |
| 138 | 138 | <div class="notegray"> |
| 139 | - <?php if(isset($error)) { echo "<small style='color:red'>".$error."</small>"; } ?> |
|
| 139 | + <?php if (isset($error)) { echo "<small style='color:red'>" . $error . "</small>"; } ?> |
|
| 140 | 140 | <h2>Comment</h2> |
| 141 | 141 | <form method="post" enctype="multipart/form-data"> |
| 142 | 142 | <textarea required cols="33" placeholder="Comment" name="comment"></textarea><br> |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | <div id="badges" class="notegray"> |
| 156 | 156 | <h1>Badges</h1> |
| 157 | 157 | <?php |
| 158 | - foreach($badges as $badge) { |
|
| 159 | - if($badge == "good") { |
|
| 158 | + foreach ($badges as $badge) { |
|
| 159 | + if ($badge == "good") { |
|
| 160 | 160 | echo "<img width='70px;' height='70px;' src='https://cdn.discordapp.com/attachments/740680780740821105/740776214523936808/340juojg3h.png'>"; |
| 161 | 161 | } |
| 162 | 162 | } |
@@ -168,10 +168,10 @@ discard block |
||
| 168 | 168 | $stmt->bind_param("s", $username); |
| 169 | 169 | $stmt->execute(); |
| 170 | 170 | $result = $stmt->get_result(); |
| 171 | - if($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 171 | + if ($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 172 | 172 | |
| 173 | - while($row = $result->fetch_assoc()) { |
|
| 174 | - echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [' , $row['type'] . ']</a><br>'; |
|
| 173 | + while ($row = $result->fetch_assoc()) { |
|
| 174 | + echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [', $row['type'] . ']</a><br>'; |
|
| 175 | 175 | }?> |
| 176 | 176 | </div><br> |
| 177 | 177 | <div id="bio" class="notegray"> |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $stmt->execute(); |
| 186 | 186 | $result = $stmt->get_result(); |
| 187 | 187 | |
| 188 | - while($row = $result->fetch_assoc()) { ?> |
|
| 188 | + while ($row = $result->fetch_assoc()) { ?> |
|
| 189 | 189 | <div class='commentRight' style='display: grid; grid-template-columns: 75% auto; padding:5px;'> |
| 190 | 190 | <div style="word-wrap: break-word;"> |
| 191 | 191 | <small><?php echo $row['date']; ?></small> |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | <a href="/media">Featured</a><br> |
| 221 | 221 | <?php |
| 222 | - if(isset($_SESSION['user'])) { echo "<a href='/home'>Manage</a><br><a href='/files'>Files<a>"; } |
|
| 222 | + if (isset($_SESSION['user'])) { echo "<a href='/home'>Manage</a><br><a href='/files'>Files<a>"; } |
|
| 223 | 223 | ?> |
| 224 | 224 | </div> |
| 225 | 225 | <br> |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='review' AND status='y' ORDER BY RAND() LIMIT 1"); |
| 230 | 230 | $stmt->execute(); |
| 231 | 231 | $result = $stmt->get_result(); |
| 232 | - while($row = $result->fetch_assoc()) { |
|
| 232 | + while ($row = $result->fetch_assoc()) { |
|
| 233 | 233 | echo "<br><img style='height: 5em;position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 234 | 234 | <small> |
| 235 | 235 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'><i>[" . $row['agerating'] . "] " . $row['title'] . "</a></i></span><br> |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='news' AND status='y' ORDER BY RAND() LIMIT 1"); |
| 246 | 246 | $stmt->execute(); |
| 247 | 247 | $result = $stmt->get_result(); |
| 248 | - while($row = $result->fetch_assoc()) { |
|
| 248 | + while ($row = $result->fetch_assoc()) { |
|
| 249 | 249 | echo "<br><img style='height: 5em;position: absolute;border: 1px solid white; width: 5em;' src='/pfp/" . getPFP($row['author'], $conn) . "'> |
| 250 | 250 | <small> |
| 251 | 251 | <a href='/view?id=" . $row['id'] . "'><span style='float:right;color: gold;'>[" . $row['agerating'] . "] <i>" . $row['title'] . "</a></i></span><br> |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC"); |
| 262 | 262 | $stmt->execute(); |
| 263 | 263 | $result = $stmt->get_result(); |
| 264 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 265 | - while($row = $result->fetch_assoc()) { |
|
| 264 | + if ($result->num_rows === 0) echo('There are no users.'); |
|
| 265 | + while ($row = $result->fetch_assoc()) { |
|
| 266 | 266 | $id = 1; |
| 267 | 267 | echo "<div class='item" . $id . "'><img style='height: 8em;width: 8em;' src='/pfp/" . getPFP($row['username'], $conn) . "'><br><a href='/?id=" . $row['id'] . "'>" . $row['username'] . "</a></div>"; |
| 268 | 268 | $id = $id + 1; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $stmt = $conn->prepare("SELECT * FROM files WHERE type='image' AND status='y' ORDER BY RAND() LIMIT 6"); |
| 280 | 280 | $stmt->execute(); |
| 281 | 281 | $result = $stmt->get_result(); |
| 282 | - while($row = $result->fetch_assoc()) { |
|
| 282 | + while ($row = $result->fetch_assoc()) { |
|
| 283 | 283 | echo "<div style='display: inline-block;' class='notegray'> |
| 284 | 284 | <a href='/view?id=" . $row['id'] . "'><img style='width: 7.5em;height: 7.5em;' src='/images/" . $row['filename'] . "'> |
| 285 | 285 | <br><center><b>" . htmlspecialchars($row['title']) . "</b><br><span style='color: gray;'>By " . $row['author'] . "</span></center> |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | while($row = $result->fetch_assoc()) { |
| 43 | 43 | $grouptitle = $row['title']; |
| 44 | 44 | } |
| 45 | - }else{ |
|
| 45 | + } else{ |
|
| 46 | 46 | $grouptitle = "none"; |
| 47 | 47 | } |
| 48 | 48 | $stmt->close(); |
@@ -168,7 +168,9 @@ discard block |
||
| 168 | 168 | $stmt->bind_param("s", $username); |
| 169 | 169 | $stmt->execute(); |
| 170 | 170 | $result = $stmt->get_result(); |
| 171 | - if($result->num_rows > 0) echo('<h1>Files</h1>'); |
|
| 171 | + if($result->num_rows > 0) { |
|
| 172 | + echo('<h1>Files</h1>'); |
|
| 173 | + } |
|
| 172 | 174 | |
| 173 | 175 | while($row = $result->fetch_assoc()) { |
| 174 | 176 | echo '<a href="/view?id=' . $row['id'] . '">' . $row['title'] . ' [' , $row['type'] . ']</a><br>'; |
@@ -261,7 +263,9 @@ discard block |
||
| 261 | 263 | $stmt = $conn->prepare("SELECT * FROM users ORDER BY id DESC"); |
| 262 | 264 | $stmt->execute(); |
| 263 | 265 | $result = $stmt->get_result(); |
| 264 | - if($result->num_rows === 0) echo('There are no users.'); |
|
| 266 | + if($result->num_rows === 0) { |
|
| 267 | + echo('There are no users.'); |
|
| 268 | + } |
|
| 265 | 269 | while($row = $result->fetch_assoc()) { |
| 266 | 270 | $id = 1; |
| 267 | 271 | echo "<div class='item" . $id . "'><img style='height: 8em;width: 8em;' src='/pfp/" . getPFP($row['username'], $conn) . "'><br><a href='/?id=" . $row['id'] . "'>" . $row['username'] . "</a></div>"; |
@@ -9,7 +9,9 @@ |
||
| 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']; |
@@ -9,8 +9,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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> |
@@ -1,11 +1,11 @@ discard block |
||
| 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 |
||
| 31 | 31 | • <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 | • <a href='/home'>Manage</a> |
| 40 | 40 | • <a href='/logout'>Logout</a> |
@@ -5,7 +5,9 @@ |
||
| 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 | |
@@ -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 != "mid") { |
|
| 26 | + if ($imageFileType != "mid") { |
|
| 27 | 27 | echo 'unsupported file type. must be .mid<hr>'; |
| 28 | 28 | $uploadOk = 0; |
| 29 | 29 | } |
@@ -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__ . "/images/"; |
| 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 != "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 | } |