175 lines
7.4 KiB
PHP
175 lines
7.4 KiB
PHP
|
|
<?php
|
|||
|
|
require_once 'config.php';
|
|||
|
|
|
|||
|
|
$error = '';
|
|||
|
|
$success = '';
|
|||
|
|
|
|||
|
|
$verification_code = $_GET['code'] ?? '';
|
|||
|
|
|
|||
|
|
if (empty($verification_code)) {
|
|||
|
|
$error = '无效的验证链接';
|
|||
|
|
} else {
|
|||
|
|
try {
|
|||
|
|
$stmt = $pdo->prepare("SELECT id, username, email FROM users WHERE verification_code = ? AND is_verified = 0");
|
|||
|
|
$stmt->execute([$verification_code]);
|
|||
|
|
$user = $stmt->fetch(PDO::FETCH_ASSOC);
|
|||
|
|
|
|||
|
|
if (!$user) {
|
|||
|
|
$error = '验证链接已过期或无效';
|
|||
|
|
} else {
|
|||
|
|
$stmt = $pdo->prepare("UPDATE users SET is_verified = 1, verification_code = NULL WHERE id = ?");
|
|||
|
|
if ($stmt->execute([$user['id']])) {
|
|||
|
|
$success = '邮箱验证成功!您现在可以登录了。';
|
|||
|
|
|
|||
|
|
sendNotification(
|
|||
|
|
$user['id'],
|
|||
|
|
'announcement',
|
|||
|
|
'邮箱验证成功',
|
|||
|
|
"恭喜您,{$user['username']}!您的邮箱验证已成功完成。现在您可以享受PicHost的所有功能。",
|
|||
|
|
'dashboard.php'
|
|||
|
|
);
|
|||
|
|
|
|||
|
|
sendEmailNotification(
|
|||
|
|
$user['id'],
|
|||
|
|
'PicHost - 邮箱验证成功',
|
|||
|
|
"
|
|||
|
|
<h2>邮箱验证成功</h2>
|
|||
|
|
<p>亲爱的 {$user['username']},</p>
|
|||
|
|
<p>您的PicHost账户邮箱验证已成功完成!</p>
|
|||
|
|
<p>现在您可以:</p>
|
|||
|
|
<ul>
|
|||
|
|
<li>上传和管理图片</li>
|
|||
|
|
<li>使用API接口</li>
|
|||
|
|
<li>接收重要通知</li>
|
|||
|
|
<li>享受完整的功能体验</li>
|
|||
|
|
</ul>
|
|||
|
|
<p>立即登录开始使用:<a href='" . SITE_URL . "/login.php'>" . SITE_URL . "/login.php</a></p>
|
|||
|
|
"
|
|||
|
|
);
|
|||
|
|
} else {
|
|||
|
|
$error = '验证失败,请稍后重试';
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
} catch(PDOException $e) {
|
|||
|
|
$error = '系统错误:' . $e->getMessage();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
?>
|
|||
|
|
<!DOCTYPE html>
|
|||
|
|
<html lang="<?php echo $lang; ?>" data-theme="<?php echo $currentUserSettings['dark_mode'] ? 'dark' : 'light'; ?>">
|
|||
|
|
<head>
|
|||
|
|
<meta charset="UTF-8">
|
|||
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|||
|
|
<title>邮箱验证 - <?php echo SITE_NAME; ?></title>
|
|||
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|||
|
|
<link rel="stylesheet" href="css/style.css">
|
|||
|
|
</head>
|
|||
|
|
<body>
|
|||
|
|
<?php include 'components/navbar.php'; ?>
|
|||
|
|
|
|||
|
|
<div class="container">
|
|||
|
|
<div class="auth-container">
|
|||
|
|
<div class="auth-card card">
|
|||
|
|
<h2><i class="fas fa-envelope-circle-check"></i> 邮箱验证</h2>
|
|||
|
|
|
|||
|
|
<?php if($error): ?>
|
|||
|
|
<div class="alert alert-error">
|
|||
|
|
<i class="fas fa-exclamation-triangle"></i> <?php echo $error; ?>
|
|||
|
|
</div>
|
|||
|
|
<div class="text-center mt-2">
|
|||
|
|
<p>遇到问题?</p>
|
|||
|
|
<a href="contact.php" class="btn btn-secondary">
|
|||
|
|
<i class="fas fa-headset"></i> 联系支持
|
|||
|
|
</a>
|
|||
|
|
<a href="index.php" class="btn">
|
|||
|
|
<i class="fas fa-home"></i> 返回首页
|
|||
|
|
</a>
|
|||
|
|
</div>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
|
|||
|
|
<?php if($success): ?>
|
|||
|
|
<div class="alert alert-success">
|
|||
|
|
<i class="fas fa-check-circle"></i> <?php echo $success; ?>
|
|||
|
|
</div>
|
|||
|
|
<div class="text-center mt-3">
|
|||
|
|
<div class="success-animation">
|
|||
|
|
<i class="fas fa-check-circle" style="font-size: 4rem; color: var(--success-color);"></i>
|
|||
|
|
</div>
|
|||
|
|
<p class="mt-2">您的账户现已完全激活</p>
|
|||
|
|
<div class="auth-links">
|
|||
|
|
<a href="login.php" class="btn btn-primary">
|
|||
|
|
<i class="fas fa-sign-in-alt"></i> 立即登录
|
|||
|
|
</a>
|
|||
|
|
<a href="index.php" class="btn btn-secondary">
|
|||
|
|
<i class="fas fa-home"></i> 返回首页
|
|||
|
|
</a>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<div class="features-highlight mt-3">
|
|||
|
|
<h4><i class="fas fa-gift"></i> 现在您可以:</h4>
|
|||
|
|
<ul style="text-align: left; margin: 15px 0; padding-left: 20px;">
|
|||
|
|
<li><i class="fas fa-cloud-upload-alt"></i> 上传和管理图片</li>
|
|||
|
|
<li><i class="fas fa-code"></i> 使用API接口</li>
|
|||
|
|
<li><i class="fas fa-bell"></i> 接收重要通知</li>
|
|||
|
|
<li><i class="fas fa-share-alt"></i> 分享图片链接</li>
|
|||
|
|
<li><i class="fas fa-tags"></i> 使用标签分类</li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
|
|||
|
|
<?php if(empty($error) && empty($success)): ?>
|
|||
|
|
<div class="text-center">
|
|||
|
|
<div class="loading-spinner">
|
|||
|
|
<i class="fas fa-spinner fa-spin" style="font-size: 3rem; color: var(--primary-color);"></i>
|
|||
|
|
</div>
|
|||
|
|
<p class="mt-2">正在验证您的邮箱...</p>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<script>
|
|||
|
|
setTimeout(() => {
|
|||
|
|
document.querySelector('.loading-spinner').innerHTML = '<i class="fas fa-exclamation-triangle" style="font-size: 3rem; color: var(--warning-color);"></i>';
|
|||
|
|
document.querySelector('.loading-spinner + p').textContent = '验证时间较长,请耐心等待...';
|
|||
|
|
}, 3000);
|
|||
|
|
</script>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<?php if(empty($error) && empty($success)): ?>
|
|||
|
|
<div class="card mt-2">
|
|||
|
|
<h4><i class="fas fa-info-circle"></i> 验证说明</h4>
|
|||
|
|
<ul style="text-align: left; margin: 10px 0; padding-left: 20px;">
|
|||
|
|
<li>邮箱验证确保您的账户安全</li>
|
|||
|
|
<li>验证后可以享受完整功能</li>
|
|||
|
|
<li>如果长时间未完成验证,请检查垃圾邮件</li>
|
|||
|
|
<li>如需帮助,请联系客服支持</li>
|
|||
|
|
</ul>
|
|||
|
|
</div>
|
|||
|
|
<?php endif; ?>
|
|||
|
|
</div>
|
|||
|
|
</div>
|
|||
|
|
|
|||
|
|
<style>
|
|||
|
|
.success-animation {
|
|||
|
|
animation: bounce 0.6s ease-in-out;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@keyframes bounce {
|
|||
|
|
0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
|
|||
|
|
40% {transform: translateY(-10px);}
|
|||
|
|
60% {transform: translateY(-5px);}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
.features-highlight {
|
|||
|
|
background: linear-gradient(135deg, #f8f9fa, #e9ecef);
|
|||
|
|
padding: 20px;
|
|||
|
|
border-radius: 10px;
|
|||
|
|
border-left: 4px solid var(--success-color);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[data-theme="dark"] .features-highlight {
|
|||
|
|
background: linear-gradient(135deg, #2d2d2d, #3d3d3d);
|
|||
|
|
}
|
|||
|
|
</style>
|
|||
|
|
</body>
|
|||
|
|
</html>
|