-1

我的注册页面是这样的

$checkForUser = mysql_query("SELECT id FROM `users` WHERE `username`='{$posts['username']}' OR `email`='{$posts['email']}'");
$checkForUserRows = mysql_num_rows($checkForUser);

$ip = VisitorIP();
$checkForIP = mysql_query("SELECT id FROM `users` WHERE `ip`='{$ip}'");
$checkForIPRows = mysql_num_rows($checkForIP);

if ($checkForUserRows > 0) {
    $error = "Username or email already registered!";
}else if ($checkForIPRows > 0)  {
    $error = "You may only have one account! This attempt has been logged. You will be banned! ";

我想自动禁止ip已经存在的帐户,出现以下错误$error = "You may only have one account! This attempt has been logged. You will be banned! ";

4

1 回答 1

0

只需用 fwrite http://php.net/manual/en/function.fwrite.php写一个日志文件

要禁止 ip,您需要在代码开头进行 ip 检查。您可能应该向数据库“禁止”添加一个 bool 列。

于 2012-09-12T05:05:13.010 回答