@@ -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']) |
@@ -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(); |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | <form method="post" enctype="multipart/form-data" id="submitform"> |
| 96 | 96 | <textarea required cols="77" placeholder="Comment" name="comment"></textarea><br> |
| 97 | 97 | <input type="submit" value="Post" <?php |
| 98 | - if ($config['use_recaptcha']) |
|
| 98 | + if ($config['use_recaptcha']) |
|
| 99 | 99 | echo 'class="g-recaptcha" data-sitekey="' . $config['recaptcha_sitekey'] . '" data-callback="onSubmit"' |
| 100 | 100 | ?>> <small>max limit: 500 characters | supports <a href="https://www.markdownguide.org/basic-syntax">Markdown</a></small> |
| 101 | 101 | </form> |
@@ -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,7 +64,7 @@ discard block |
||
| 64 | 64 | <br><br>" . $extrainfo . "</small><hr>"; |
| 65 | 65 | ?> |
| 66 | 66 | <?php |
| 67 | - switch($type) { |
|
| 67 | + switch ($type) { |
|
| 68 | 68 | case "song": |
| 69 | 69 | echo '<audio controls> <source src="/dynamic/song/' . $filename . '"> </audio>'; |
| 70 | 70 | break; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $result = $stmt->get_result(); |
| 107 | 107 | ?> |
| 108 | 108 | <div class="commentsList"> |
| 109 | - <?php while($row = $result->fetch_assoc()) { ?> |
|
| 109 | + <?php while ($row = $result->fetch_assoc()) { ?> |
|
| 110 | 110 | <div class='commentRight' style='display: grid; grid-template-columns: auto 85%; padding:5px;'> |
| 111 | 111 | <div> |
| 112 | 112 | <a style='float: left;' href='/view/profile?id=<?php echo getID($row['author'], $conn); ?>'><?php echo $row['author']; ?></a> |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | </div> |
| 116 | 116 | <div style="word-wrap: break-word;"> |
| 117 | 117 | <small><?php echo $row['date']; ?></small> |
| 118 | - <?php echo validateMarkdown($row['text']);?> |
|
| 118 | + <?php echo validateMarkdown($row['text']); ?> |
|
| 119 | 119 | </div> |
| 120 | 120 | </div> |
| 121 | 121 | <?php } ?> |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/../important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | 16 | $register = require(__DIR__ . "/../func/upload.php"); |
| 17 | 17 | $register("game", ["swf"], $conn); |
| 18 | 18 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/../important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | 16 | $register = require(__DIR__ . "/../func/upload.php"); |
| 17 | 17 | $register("midi", ["mid"], $conn); |
| 18 | 18 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/../important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | 16 | $register = require(__DIR__ . "/../func/upload.php"); |
| 17 | 17 | $register("video", ["mp4"], $conn); |
| 18 | 18 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/../important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | 16 | $register = require(__DIR__ . "/../func/upload.php"); |
| 17 | 17 | $register("chiptune", ["xm", "mod", "s3m", "it"], $conn); |
| 18 | 18 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/../important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | 16 | $register = require(__DIR__ . "/../func/upload.php"); |
| 17 | 17 | $register("song", ["ogg", "mp3"], $conn); |
| 18 | 18 | } |
@@ -12,7 +12,7 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/../important/header.php"); |
| 14 | 14 | |
| 15 | - if(@$_POST['submit']) { |
|
| 15 | + if (@$_POST['submit']) { |
|
| 16 | 16 | $register = require(__DIR__ . "/../func/upload.php"); |
| 17 | 17 | $register("image", ["gif", "png", "jpg", "jpeg"], $conn); |
| 18 | 18 | } |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | <?php require(__DIR__ . "/../important/header.php"); ?> |
| 22 | 22 | <div class="container"> |
| 23 | 23 | <h1>2-Factor Authentication</h1> |
| 24 | - 2FA status: <?php if ($otpstatus) {echo "enabled";} else {echo "disabled";}?><br> |
|
| 25 | - <?php if ($otpstatus) {echo "Backup code: " . $result->fetch_assoc()['otpbackupcode'];} ?><br><br> |
|
| 24 | + 2FA status: <?php if ($otpstatus) {echo "enabled"; } else {echo "disabled"; }?><br> |
|
| 25 | + <?php if ($otpstatus) {echo "Backup code: " . $result->fetch_assoc()['otpbackupcode']; } ?><br><br> |
|
| 26 | 26 | <button> |
| 27 | 27 | <?php if ($otpstatus) { ?> |
| 28 | 28 | <a href="/2fa/disable">Disable 2FA</a> |