This commit is contained in:
aftercase 2021-07-11 20:30:22 +01:00
commit 8b1909c496

View file

@ -31,14 +31,12 @@ if (isset($_SESSION['token'])) {
header("Location: ./");
}
$admin_mail = $email;
$admin_name = $site_name;
// Email information
$email_info_rows = $conn->query("SELECT * FROM mail WHERE id='1'");
$email_info_rows = $conn->query("SELECT * FROM mail LIMIT 1");
while ($row = $email_info_rows->fetch()) {
$verification = Trim($row['verification']);
$smtp_host = Trim($row['smtp_host']);
@ -59,11 +57,11 @@ updatePageViews($conn);
if (isset($_GET['resend'])) {
if (isset($_POST['email'])) {
$email = htmlentities(trim($_POST['email']));
$statement = $conn->prepare("SELECT * FROM users WHERE email_id=?");
$statement = $conn->prepare("SELECT * FROM users WHERE email_id = ?");
$statement->execute([$email]);
if ($statement->fetchColumn() > 0) {
// Username found
foreach ($statement as $index=>$row) {
foreach ($statement as $index => $row) {
$username = $row['username'];
$db_email_id = $row['email_id'];
$db_platform = $row['platform'];
@ -154,8 +152,8 @@ if (isset($_GET['forgot'])) {
}
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Check if logged in
if (isset($_SESSION['token'])) {
@ -216,8 +214,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
}
// Register process
if (isset($_POST['signup'])) {
// Register process
if (isset($_POST['signup'])) {
$username = htmlentities(trim($_POST['username'], ENT_QUOTES));
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$email = htmlentities(trim($_POST['email'], ENT_QUOTES));
@ -225,10 +223,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error = $lang['email_invalid']; // "Your email address seems to be invalid.";
}else{
if(strlen($username)>$chara_max){
} else {
if (strlen($username) > $chara_max) {
$error = $lang['maxnamelimit']; // "Username already taken.";
}else{
} else {
if ($username != null && $password != null && $email != null) {
$res = isValidUsername($username);
if ($res == '1') {
@ -292,4 +290,3 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
require_once('theme/' . $default_theme . '/header.php');
require_once('theme/' . $default_theme . '/login.php');
require_once('theme/' . $default_theme . '/footer.php');
?>