53 lines
1.9 KiB
PHP
53 lines
1.9 KiB
PHP
<?php
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
$message = '';
|
|
$status = 'error';
|
|
|
|
if (isset($_GET['code'])) {
|
|
$code = $_GET['code'];
|
|
|
|
$stmt = db()->prepare("SELECT id FROM users WHERE verification_code = ? AND verified = 0");
|
|
$stmt->execute([$code]);
|
|
$user = $stmt->fetch();
|
|
|
|
if ($user) {
|
|
$update = db()->prepare("UPDATE users SET verified = 1, verification_code = NULL WHERE id = ?");
|
|
if ($update->execute([$user['id']])) {
|
|
$message = "Email verified successfully! You can now log in.";
|
|
$status = 'success';
|
|
} else {
|
|
$message = "Something went wrong. Please try again later.";
|
|
}
|
|
} else {
|
|
$message = "Invalid or expired verification link.";
|
|
}
|
|
} else {
|
|
$message = "No verification code provided.";
|
|
}
|
|
|
|
$platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Email Verification — <?= htmlspecialchars($platformName) ?></title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
|
</head>
|
|
<body style="display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px;">
|
|
|
|
<div class="card" style="width: 100%; max-width: 500px; text-align: center;">
|
|
<div class="logo" style="margin-bottom: 30px;"><?= htmlspecialchars($platformName) ?></div>
|
|
|
|
<h2 style="margin-bottom: 20px;"><?= $status === 'success' ? 'Verification Successful' : 'Verification Failed' ?></h2>
|
|
<p style="color: var(--text-secondary); margin-bottom: 30px;"><?= htmlspecialchars($message) ?></p>
|
|
|
|
<a href="login.php" class="btn btn-primary" style="width: 100%; padding: 15px;">Go to Log In</a>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|