@@ -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> |
@@ -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> |
@@ -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="/dynamic/song/' . $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>"; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | return function($type, $allowedFileTypes, $conn) { |
| 3 | - if(isset($_SESSION['user'])) { |
|
| 3 | + if (isset($_SESSION['user'])) { |
|
| 4 | 4 | $fileType = strtolower(pathinfo($_FILES["fileToUpload"]["name"], PATHINFO_EXTENSION)); |
| 5 | 5 | $target_dir = __DIR__ . "/../dynamic/" . $type . "/"; |
| 6 | 6 | $target_name = md5_file($_FILES["fileToUpload"]["tmp_name"]) . "." . $fileType; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $movedFile = move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - if(!in_array($fileType, $allowedFileTypes)) { |
|
| 18 | + if (!in_array($fileType, $allowedFileTypes)) { |
|
| 19 | 19 | echo 'unsupported file type. must be one of ' . join(", ", $allowedFileTypes) . '<hr>'; |
| 20 | 20 | $uploadOk = 0; |
| 21 | 21 | } |
@@ -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 | } |