我在注册后为激活用户的帐户开发了一个php电子邮件激活码,我想要的是如果用户第一次点击激活链接后,该链接将被禁用,任何人都可以提供帮助,非常感谢! 这是我的PHP代码:
$to = $email;
$subject = " Your Registration";
$message = "Welcome to our website!\r\rThanks for completing registration at www.example.com.
You can complete registration by clicking the following link:\rhttp://www.example.com/verify.php?$activationKey\r\rIf this is an error, ignore this email and you will be removed from our mailing list.\r\rRegards,\ www.example.com Team";
$headers = 'From: noreply@ example.com' . "\r\n" .
'Reply-To: noreply@ example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
答案 0 :(得分:2)
您需要将activation code
保存到数据库中,每当他/她请求激活时,将请求的激活码与数据库进行比较,如果有效,则必须remove
activation code
confirm
1}}在您为该帐户设置{{1}}参数后立即从数据库中获取。