我有一个注册脚本,用户可以在我的网站上创建。我真的很挣扎与电子邮件被发送一个巨大的延迟,这意味着注册链接已经过期之前,任何用户得到他们的电子邮件。
<?php
}
else
{
if (isset($_POST['n_register']))
{
$mail = trim($db->EscapeString($_POST['reg_mail']));
$mail_re = trim($db->EscapeString($_POST['reg_mail_re']));
if (!preg_match("/^[a-zA-Z_\\-][\\w\\.\\-_]*[a-zA-Z0-9_\\-]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$/i", $mail))
{
$errorMsg = $langBase->get('home-08');
}
elseif ($mail !== $mail_re)
{
$errorMsg = $langBase->get('home-09');
}
elseif ($db->GetNumRows($db->Query("SELECT id FROM `[users]` WHERE `email`='".$mail."' LIMIT 1")) > 0)
{
$errorMsg = $langBase->get('home-10');
}
elseif ($db->GetNumRows($db->Query("SELECT id FROM `[users]` WHERE `IP_regged_with`='".$_SERVER['REMOTE_ADDR']."' LIMIT 1")) > 0)
{
$errorMsg = $langBase->get('home-11');
}
elseif ($db->GetNumRows($db->Query("SELECT id FROM `temporary` WHERE `playerid`='".$mail."' AND `active`='1' AND `area`='register' AND `time_added`+`expires`>'".time()."' LIMIT 1")) > 0)
{
$errorMsg = 'You should already have an activation email from us. Check the spam box, if not, contact us.';
}
elseif (!isset($_POST['acc_tos']))
{
$errorMsg = $langBase->get('home-12');
}
else
{
$extra = array(
'mail' => $mail,
'enlist' => isset($_GET['e']) ? $db->EscapeString($_GET['e']) : $ref_id,
'affid' => isset($_GET['aff']) ? $db->EscapeString($_GET['aff']) : $aff_id
);
$enlist_id = isset($_GET['e']) ? $db->EscapeString($_GET['e']) : $ref_id;
$tempID = substr(sha1(uniqid(rand())), 0, 6);
$db->Query("INSERT INTO `temporary` (`id`, `playerid`, `area`, `expires`, `time_added`, `extra`)VALUES('".$tempID."', '".$mail."', 'register', '10000', '".time()."', '".serialize($extra)."')");
mail($mail, $admin_config['game_name']['value'].' » Game Regsitration', 'href="'.$config['base_url'].'?side=signup&step=2&v='.$tempID.'">'.$config['base_url'].'?side=signup&step=2&v='.$tempID.'</a>
<br />
This link will remain active until <b>'.View::Time(time()+10000, true).''.$admin_config['game_name']['value'].'
有人看到这里有什么问题吗?也许电子邮件文本需要更长一些?在这个脚本的中间显然有一些html。
谢谢!
暂无答案!
目前还没有任何答案,快来回答吧!