我很难找出我的 PHP 用户/注册站点的错误。注册后会发送一封带有激活链接的电子邮件,单击该链接时会成功激活帐户,但未显示成功消息。
如果我在浏览器中复制/粘贴激活链接并更改链接中的电子邮件或电子邮件代码中的字母,它将成功地给我所有错误消息。
激活链接如下所示:
这是我的 activate.php 的代码
<?php
include 'core/init.php';
logged_in_redirect();
include 'includes/overall/header.php';
?>
<?php
if (isset($_GET['success']) == true && empty($_GET['success']) == true) {
?>
<h3>Thanks, your account has been activated..</h3>
<p>You're free to log in!</p>
<?php
header('Location: activate.php?success');
exit();
} else if (isset($_GET['email'], $_GET['email_code']) === true) {
$email = trim($_GET['email']);
$email_code = trim($_GET['email_code']);
if (email_exists($email) === false) {
$errors[] = 'Ooops something went wrong, and we couldn\'t find that email adress!';
} else if (activate($email, $email_code) === false) {
$errors[] = 'We had problems activating your account';
} if (empty($errors) === false) {
?>
<h2>Ooops...</h2>
<?php
echo output_errors($errors);
} else {
header('Location: activate.php?success');
exit();
}
} else {
header('Location: index.php');
exit();
}
?>
<?php include 'includes/overall/footer.php'; ?>
为什么它不给我成功消息并重定向?
至:website.com/activate.php?success