Checktheban and include problem

JoshuaS

Learning
Jan 9, 2014
119
13
Hi DB.
I'm currently working on a cms with arcturus and i have a problem with my checktheban.php.
I use this:
PHP:
<?php
$userID = (isset($_SESSION['user']['id'])) ? $_SESSION['user']['id'] : 0;
$ip = (isset($_SERVER["HTTP_CF_CONNECTING_IP"]) && !empty($_SERVER["HTTP_CF_CONNECTING_IP"])) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];
$getBan = mysql_query("SELECT * FROM bans WHERE user_id = '{$userID}' OR ip = '{$ip}' ORDER BY ban_expire DESC LIMIT 1");

while($ban = mysql_fetch_array($getBan))
{
    if($ban['ban_expire'] >= time())
    {
        if($ban['type'] == 'account') die(header('Location: /banned'));

        die(header('Location: /ipbanned'));
    }
}
?>
and this
PHP:
final public function isBanned($value)
    {
        global $engine;
        if($engine->num_rows("SELECT * FROM bans WHERE value = '" . $value . "' LIMIT 1") > 0)
        {
            return true;
        }
            
        return false;
    }
    
    final public function getReason($value)
    {
        global $engine;
        return $engine->result("SELECT ban_reason FROM bans WHERE value = '" . $value . "' LIMIT 1");
    }
    
    final public function hasClones($ip)
    {
        global $engine;
        if($engine->num_rows("SELECT * FROM users WHERE ip_register = '" . $_SERVER['REMOTE_ADDR'] . "'") == 2)        {
            return true;
        }
        
        return false;
    }
The problem that i have is, that even when i ban someone, its not only the account, but it seems to be the whole ip. I'm using arcturus. I hope someone can help.
Thx
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
Hi DB.
I'm currently working on a cms with arcturus and i have a problem with my checktheban.php.
I use this:
PHP:
<?php
$userID = (isset($_SESSION['user']['id'])) ? $_SESSION['user']['id'] : 0;
$ip = (isset($_SERVER["HTTP_CF_CONNECTING_IP"]) && !empty($_SERVER["HTTP_CF_CONNECTING_IP"])) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];
$getBan = mysql_query("SELECT * FROM bans WHERE user_id = '{$userID}' OR ip = '{$ip}' ORDER BY ban_expire DESC LIMIT 1");

while($ban = mysql_fetch_array($getBan))
{
    if($ban['ban_expire'] >= time())
    {
        if($ban['type'] == 'account') die(header('Location: /banned'));

        die(header('Location: /ipbanned'));
    }
}
?>
and this
PHP:
final public function isBanned($value)
    {
        global $engine;
        if($engine->num_rows("SELECT * FROM bans WHERE value = '" . $value . "' LIMIT 1") > 0)
        {
            return true;
        }
            
        return false;
    }
    
    final public function getReason($value)
    {
        global $engine;
        return $engine->result("SELECT ban_reason FROM bans WHERE value = '" . $value . "' LIMIT 1");
    }
    
    final public function hasClones($ip)
    {
        global $engine;
        if($engine->num_rows("SELECT * FROM users WHERE ip_register = '" . $_SERVER['REMOTE_ADDR'] . "'") == 2)        {
            return true;
        }
        
        return false;
    }
The problem that i have is, that even when i ban someone, its not only the account, but it seems to be the whole ip. I'm using arcturus. I hope someone can help.
Thx
Then you should maybe just ban the account and not the IP?

Sent from my SM-G955F using Tapatalk
 

Joe

Well-Known Member
Jun 10, 2012
4,090
1,918
Looks like you’ve provided us with the wrong code. Since I’ve never used Arcturus I don’t know what to suggest.

What command are you using? Is there a user and ip ban added to the banned table in the database when you ban somebody?
 

JoshuaS

Learning
Jan 9, 2014
119
13
Looks like you’ve provided us with the wrong code. Since I’ve never used Arcturus I don’t know what to suggest.

What command are you using? Is there a user and ip ban added to the banned table in the database when you ban somebody?
well include was a mistake. I just run them as
PHP:
<?php include ("includes/checktheban.php") ?>
. Just thought the class.user was worth something also. I use mod tools and just :ban x 600. But it adds everything to the table about the account. Ip, machineid, username etc.
 

HarmonicRain

NextGenHabbo.com
Jun 27, 2012
177
163
Arcturus has a check if a user is banned anyway, surely you just make it check the bans table and if a user logs in and their ID matches with that in the bans table send them to the banned page?

$ip = (isset($_SERVER["HTTP_CF_CONNECTING_IP"]) && !empty($_SERVER["HTTP_CF_CONNECTING_IP"])) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];

You're checking ips there anyway?
 

Users who are viewing this thread

Top