1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Fixes #1117 - Duplicate failed login messages. Also corrected accidental localhost/developer IP banning issue.

This commit is contained in:
Cameron 2015-07-07 12:07:17 -07:00
parent 45ffe2afb5
commit a27dc90ca7
5 changed files with 14 additions and 5 deletions

View File

@ -31,6 +31,7 @@ class e107
* IPV6 string for localhost - as stored in DB
*/
const LOCALHOST_IP = '0000:0000:0000:0000:0000:ffff:7f00:0001';
const LOCALHOST_IP2 = '0000:0000:0000:0000:0000:0000:0000:0001';
public $server_path;

View File

@ -64,7 +64,8 @@ class eIPHandler
/**
* IPV6 string for localhost - as stored in DB
*/
const LOCALHOST_IP = '0000:0000:0000:0000:0000:ffff:7f00:0001';
// const LOCALHOST_IP = '0000:0000:0000:0000:0000:ffff:7f00:0001';
const BAN_REASON_COUNT = 7; // Update as more ban reasons added (max 10 supported)
@ -834,7 +835,7 @@ class eIPHandler
if($this->actionCount)
{
$ip = $this->getip(); // This will be in normalised IPV6 form
if ($ip != eIPHandler::LOCALHOST_IP)
if ($ip != e107::LOCALHOST_IP && $ip != e107::LOCALHOST_IP2)
{ // Check host name, user email to see if banned
$vals = array();
if (e107::getPref('enable_rdns'))
@ -939,6 +940,13 @@ class eIPHandler
*/
public function add_ban($bantype, $ban_message = '', $ban_ip = '', $ban_user = 0, $ban_notes = '')
{
if ($ban_ip == e107::LOCALHOST_IP || $ban_ip == e107::LOCALHOST_IP2)
{
return false;
}
$sql = e107::getDb();
$pref = e107::getPref();

View File

@ -571,7 +571,7 @@ class userlogin
$this->logNote('LAN_ROLL_LOG_10', $username);
}
e107::getMessage()->addError($message);
e107::getMessage()->reset()->addError($message); // prevent duplicates.
if($this->testMode === true)
{

View File

@ -212,7 +212,7 @@ class e_online
}
// Always allow localhost - any problems are usually semi-intentional!
if ((varset($row['online_ip']) != '127.0.0.1') && (varset($row['online_ip']) != e107::LOCALHOST_IP))
if ((varset($row['online_ip']) != '127.0.0.1') && (varset($row['online_ip']) != e107::LOCALHOST_IP) && (varset($row['online_ip']) != e107::LOCALHOST_IP2))
{
// Check for excessive access
if ($row['online_pagecount'] > $online_bancount)

View File

@ -634,7 +634,7 @@ if (isset($_POST['register']) && intval($pref['user_reg']) === 1)
// check for multiple signups from the same IP address. But ignore localhost
if ($allData['user_ip'] != e107::LOCALHOST_IP)
if ($allData['user_ip'] != e107::LOCALHOST_IP && $allData['user_ip'] != e107::LOCALHOST_IP2)
{
if($ipcount = $sql->select('user', '*', "user_ip='".$allData['user_ip']."' and user_ban !='2' "))
{