@@ -12,18 +12,18 @@ |
||
| 12 | 12 | <body> |
| 13 | 13 | <?php require(__DIR__ . "/important/header.php"); |
| 14 | 14 | |
| 15 | - if(isset($_GET['id'])) { |
|
| 15 | + if (isset($_GET['id'])) { |
|
| 16 | 16 | $stmt = $conn->prepare("SELECT * FROM files WHERE author = ? AND id = ?"); |
| 17 | 17 | $stmt->bind_param("si", $_SESSION['user'], $_GET['id']); |
| 18 | 18 | $stmt->execute(); |
| 19 | 19 | $result = $stmt->get_result(); |
| 20 | - if($result->num_rows === 0) die('Item doesnt exist or item isnt made by you.'); |
|
| 20 | + if ($result->num_rows === 0) die('Item doesnt exist or item isnt made by you.'); |
|
| 21 | 21 | } else { |
| 22 | 22 | header("Location: index.php"); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if(@$_POST['submit']) { |
|
| 26 | - if(isset($_SESSION['user'])) { |
|
| 25 | + if (@$_POST['submit']) { |
|
| 26 | + if (isset($_SESSION['user'])) { |
|
| 27 | 27 | $stmt = $conn->prepare("UPDATE files SET title = ?, extrainfo = ? WHERE id = ?"); |
| 28 | 28 | $stmt->bind_param("ssi", $title, $description, $_GET['id']); |
| 29 | 29 | $title = htmlspecialchars($_POST['title']); |
@@ -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 ('news', ?, ?, ?, '')"); |
| 18 | 18 | $stmt->bind_param("sss", $title, $description, $_SESSION['user']); |
| 19 | 19 | |
@@ -2,13 +2,13 @@ |
||
| 2 | 2 | require(__DIR__ . "/func/func.php"); |
| 3 | 3 | require(__DIR__ . "/func/conn.php"); |
| 4 | 4 | |
| 5 | -if(isset($_SESSION['user'])) { |
|
| 6 | - if(isset($_GET['id'])) { |
|
| 5 | +if (isset($_SESSION['user'])) { |
|
| 6 | + if (isset($_GET['id'])) { |
|
| 7 | 7 | $stmt = $conn->prepare("SELECT * FROM `groups` WHERE id = ?"); |
| 8 | 8 | $stmt->bind_param("i", $_GET['id']); |
| 9 | 9 | $stmt->execute(); |
| 10 | 10 | $result = $stmt->get_result(); |
| 11 | - if($result->num_rows === 0) { |
|
| 11 | + if ($result->num_rows === 0) { |
|
| 12 | 12 | die("Group doesn't exist"); |
| 13 | 13 | } |
| 14 | 14 | $stmt->close(); |
@@ -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']); |
@@ -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> |
@@ -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> |
@@ -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 | } |