@@ -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(); |
@@ -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> |