120 lines
4.5 KiB
PHP
120 lines
4.5 KiB
PHP
<?php
|
|
|
|
require_once 'includes/connect.php';
|
|
require_once 'includes/checkuser.php';
|
|
|
|
require_once 'includes/i18n/languages.php';
|
|
require_once 'includes/i18n/getlang.php';
|
|
require_once 'includes/i18n/' . $lang . '.php';
|
|
|
|
require_once 'includes/version.php';
|
|
|
|
if ($userCount == 0) {
|
|
header("Location: registration.php");
|
|
exit();
|
|
}
|
|
|
|
session_start();
|
|
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
|
$db->close();
|
|
header("Location: .");
|
|
exit();
|
|
}
|
|
|
|
$theme = "light";
|
|
if (isset($_COOKIE['theme'])) {
|
|
$theme = $_COOKIE['theme'];
|
|
}
|
|
|
|
$colorTheme = "blue";
|
|
if (isset($_COOKIE['colorTheme'])) {
|
|
$colorTheme = $_COOKIE['colorTheme'];
|
|
}
|
|
|
|
$validated = false;
|
|
|
|
if (isset($_GET['email']) && isset($_GET['token'])) {
|
|
$email = $_GET['email'];
|
|
$token = $_GET['token'];
|
|
|
|
$query = "SELECT * FROM email_verification WHERE email = :email AND token = :token";
|
|
$stmt = $db->prepare($query);
|
|
$stmt->bindValue(':email', $email, SQLITE3_TEXT);
|
|
$stmt->bindValue(':token', $token, SQLITE3_TEXT);
|
|
$result = $stmt->execute();
|
|
$row = $result->fetchArray(SQLITE3_ASSOC);
|
|
|
|
if ($row) {
|
|
$query = "DELETE FROM email_verification WHERE email = :email AND token = :token";
|
|
$stmt = $db->prepare($query);
|
|
$stmt->bindValue(':email', $email, SQLITE3_TEXT);
|
|
$stmt->bindValue(':token', $token, SQLITE3_TEXT);
|
|
$stmt->execute();
|
|
|
|
$validated = true;
|
|
|
|
header("Location: login.php?validated=true");
|
|
exit;
|
|
|
|
} else {
|
|
$query = "SELECT require_email_verification FROM admin";
|
|
$stmt = $db->prepare($query);
|
|
$result = $stmt->execute();
|
|
$settings = $result->fetchArray(SQLITE3_ASSOC);
|
|
|
|
if ($settings['require_email_verification'] != 1) {
|
|
header("Location: .");
|
|
exit;
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html dir="<?= $languages[$lang]['dir'] ?>">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
|
<meta name="theme-color" content="<?= $theme == "light" ? "#FFFFFF" : "#222222" ?>"/>
|
|
<title>Wallos - Subscription Tracker</title>
|
|
<link rel="icon" type="image/png" href="images/icon/favicon.ico" sizes="16x16">
|
|
<link rel="apple-touch-icon" sizes="180x180" href="images/icon/apple-touch-icon.png">
|
|
<link rel="manifest" href="manifest.json">
|
|
<link rel="stylesheet" href="styles/theme.css?<?= $version ?>">
|
|
<link rel="stylesheet" href="styles/login.css?<?= $version ?>">
|
|
<link rel="stylesheet" href="styles/themes/red.css?<?= $version ?>" id="red-theme" <?= $colorTheme != "red" ? "disabled" : "" ?>>
|
|
<link rel="stylesheet" href="styles/themes/green.css?<?= $version ?>" id="green-theme" <?= $colorTheme != "green" ? "disabled" : "" ?>>
|
|
<link rel="stylesheet" href="styles/themes/yellow.css?<?= $version ?>" id="yellow-theme" <?= $colorTheme != "yellow" ? "disabled" : "" ?>>
|
|
<link rel="stylesheet" href="styles/font-awesome.min.css">
|
|
<link rel="stylesheet" href="styles/barlow.css">
|
|
<link rel="stylesheet" href="styles/login-dark-theme.css?<?= $version ?>" id="dark-theme" <?= $theme == "light" ? "disabled" : "" ?>>
|
|
</head>
|
|
<body class="<?= $languages[$lang]['dir'] ?>">
|
|
<div class="content">
|
|
<section class="container">
|
|
<header>
|
|
<?php
|
|
if ($theme == "light") {
|
|
?> <img src="images/siteicons/<?= $colorTheme ?>/wallos.png" alt="Wallos Logo" title="Wallos - Subscription Tracker" width="215" /> <?php
|
|
} else {
|
|
?> <img src="images/siteicons/<?= $colorTheme ?>/walloswhite.png" alt="Wallos Logo" title="Wallos - Subscription Tracker" width="215" /> <?php
|
|
}
|
|
?>
|
|
</header>
|
|
<div class="message">
|
|
<?php
|
|
if ($validated == false) {
|
|
?>
|
|
<ul class="error-box">
|
|
<li><i class="fa-solid fa-triangle-exclamation"></i><?= translate('email_verification_failed', $i18n) ?></li>
|
|
</ul>
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="separator"></div>
|
|
<input type="button" class="button" onclick="window.location.href='login.php'" value="<?= translate('login', $i18n) ?>"></input>
|
|
</section>
|
|
</div>
|
|
</body>
|
|
</html>
|