2012-09-12 36 views
-1

我的註冊頁面看起來像這樣做一個日誌文件用PHP

$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! ";

+1

問題是什麼?你得到什麼錯誤,或者你看到了什麼? (請注意,您使用的是不安全的代碼,可能會被黑客入侵,此外還會使用即將被折舊的函數。與使用mysql_()函數相反,請檢查手冊中的PDO和/或mysqli_()函數。) – Robbie

回答