【发布时间】:2011-09-21 09:12:44
【问题描述】:
我开发了一个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);
【问题讨论】:
-
您需要一个唯一的、可识别的字段值(
key、activateid等)来验证请求,然后您需要存储一个表明帐户已激活的值,然后是检查 activate.php 代码以确保它尚未被使用。
标签: php