RevCMS Banned Page

Blasteh

Lord Farquaad
Apr 3, 2013
1,151
513
I'm looking to fix something in my CMS that I just never got around to, I fixed it before in my old CMS but I seem to forget how I fixed it honestly.

Anyways, basically, users can view the /banned page when they're not banned. I want it so if there not banned, it'll redirect to the /me page. In my pages, I have
Code:
<?php include('includes/checktheban.php'); ?>
on the top of each page, so if they are banned, they cannot view the page. But the problem is, users who aren't banned can view the ban page.

Thanks.
 

Blasteh

Lord Farquaad
Apr 3, 2013
1,151
513
Go to APP/class.core.php and post it here for me
Code:
<?php

namespace Revolution;
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
class core implements iCore
{

    final public function getOnline()
    {
        global $engine;
        return $engine->result("SELECT COUNT(online) FROM users WHERE `online`='1' LIMIT 1");
    }
    final public function getBans()
        {
                global $engine;
                return $engine->result("SELECT count(id) from bans");
        }
 
        final public function GetRegisteredUsers()
        {
                global $engine;
                return $engine->result("SELECT count(id) from users");
        }
 
        final public function GetVIPUsers()
        {
                global $engine;
                return $engine->result("SELECT count(id) from users WHERE rank = '2'");
        }
 
        final public function GetStaffUsers()
        {
                global $engine;
                return $engine->result("SELECT count(id) from users WHERE rank >= '5'");
        }
    
    final public function getStatus()
    {
        global $engine;
        return $engine->result("SELECT status FROM server_status");
    }
    
    final public function systemError($who, $txt)
    {
        die('<b>' . $who . ' - RevCMS: </b><br /> <center>' . $txt . '</center>');
    }
    
    final public function handleCall($k)
    {
        global $users, $template, $_CONFIG, $engine;
    if($engine->result("SELECT maintenance FROM settings WHERE id = 1 AND maintenance = 'nope'"))
        {
            if(!isset($_SESSION['user']['id']))
            {
                switch($k)
                {
                    case "index":
                    case null:
                    case "login":
                        $users->login();
                    break;
                    
                    case "register":
                    $users->register();
                    break;
                    
                    case "maintenance":
                    case "ToS":
                        //
                    break;
                
                    case "me":
                    case "account":
                    case "news":
                        header('Location: '.$_CONFIG['hotel']['url'].'/index');
                        exit;
                    break;
                    
                    default:
                        //Nothing
                    break;
                }
            }
            else
            {
                if($_SESSION['user']['ip_last'] != $_SERVER['REMOTE_ADDR'])
                {
                    header('Location: '.$_CONFIG['hotel']['url'].'/logout');
                }
                
                switch($k)
                {
                    case "index":
                    case null:
                        header('Location: '.$_CONFIG['hotel']['url'].'/me');
                    exit;
                    break;
                    
                    case "register":
                    header('Location: '.$_CONFIG['hotel']['url'].'/me');
                    exit;
                    break;
                    
                    case "client":
                        $users->createSSO($_SESSION['user']['id']);
                        $users->updateUser($_SESSION['user']['id'], 'ip_last', $_SERVER['REMOTE_ADDR']);
                        $template->setParams('sso', $users->getInfo($_SESSION['user']['id'], 'auth_ticket'));
                    break;
                        
                    case "help":
                        $users->help();
                    break;
                
                    case "account":
                        $users->updateAccount();
                    break;
                    
                    default:
                        //nothing
                    break;
                }
            }
        }
        elseif($_GET['url'] != 'maintenance')
        {

            if($_SESSION['user']['rank'] > 6){
                
            }

            else{
            header('Location: '. $_CONFIG['hotel']['url'] .'/maintenance');
            exit;
            }
        }   
    }
    
    final public function handleCallHK($k)
    {
        global $users, $engine, $_CONFIG;
        
        if($_SESSION["in_hk"] != true)
        {
            if(isset($_SESSION['user']['id']))
            {
                if($k == 'login')
                {
                    $users->loginHK();
                }
                else
                {
                    header("Location:".$_CONFIG['hotel']['url']."/ase/login");
                    exit;
                }
            }
            else
            {
                header("Location:".$_CONFIG['hotel']['url']."/index");
                exit;
            }
        }
        else
        {
            if(!isset($k))
            {
                header("Location:".$_CONFIG['hotel']['url']."/ase/dash");
                exit;
            }
            else
            {
                if($k == 'balist')
                {
                        
                    if(isset($_GET["unban"]))
                    {
                        $user = $engine->secure($_GET["unban"]);
                        $engine->query("DELETE FROM bans WHERE id = '" . $user . "'");
                        header("Location: ".$_CONFIG['hotel']['url']."/ase/banlist");
                        exit;
                    }   
                }
            }
        }
    }
    
    final public function hashed($password)
    {
        return md5($password);
    }
}
?>
 

Blasteh

Lord Farquaad
Apr 3, 2013
1,151
513
Replace with this and let me know if it works
Code:
<?php

namespace Revolution;
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
class core implements iCore
{

    final public function getOnline()
    {
        global $engine;
        return $engine->result("SELECT COUNT(online) FROM users WHERE `online`='1' LIMIT 1");
    }
    final public function getBans()
        {
                global $engine;
                return $engine->result("SELECT count(id) from bans");
        }
 
        final public function GetRegisteredUsers()
        {
                global $engine;
                return $engine->result("SELECT count(id) from users");
        }
 
        final public function GetVIPUsers()
        {
                global $engine;
                return $engine->result("SELECT count(id) from users WHERE rank = '2'");
        }
 
        final public function GetStaffUsers()
        {
                global $engine;
                return $engine->result("SELECT count(id) from users WHERE rank >= '5'");
        }
   
    final public function getStatus()
    {
        global $engine;
        return $engine->result("SELECT status FROM server_status");
    }
   
    final public function systemError($who, $txt)
    {
        die('<b>' . $who . ' - RevCMS: </b><br /> <center>' . $txt . '</center>');
    }
   
    final public function handleCall($k)
    {
        global $users, $template, $_CONFIG, $engine;
    if($engine->result("SELECT maintenance FROM settings WHERE id = 1 AND maintenance = 'nope'"))
        {
            if(!isset($_SESSION['user']['id']))
            {
                switch($k)
                {
                    case "index":
                    case null:
                    case "login":
                        $users->login();
                    break;
                   
                    case "register":
                    $users->register();
                    break;
                   
                    case "maintenance":
                    case "ToS":
                        //
                    break;
               
                    case "me":
                    case "account":
                    case "news":
                    case "banned":
                        header('Location: '.$_CONFIG['hotel']['url'].'/index');
                        exit;
                    break;
                   
                    default:
                        //Nothing
                    break;
                }
            }
            else
            {
                if($_SESSION['user']['ip_last'] != $_SERVER['REMOTE_ADDR'])
                {
                    header('Location: '.$_CONFIG['hotel']['url'].'/logout');
                }
               
                switch($k)
                {
                    case "index":
                    case null:
                        header('Location: '.$_CONFIG['hotel']['url'].'/me');
                    exit;
                    break;
                   
                    case "register":
                    header('Location: '.$_CONFIG['hotel']['url'].'/me');
                    exit;
                    break;
                   
                    case "client":
                        $users->createSSO($_SESSION['user']['id']);
                        $users->updateUser($_SESSION['user']['id'], 'ip_last', $_SERVER['REMOTE_ADDR']);
                        $template->setParams('sso', $users->getInfo($_SESSION['user']['id'], 'auth_ticket'));
                    break;
                       
                    case "help":
                        $users->help();
                    break;
               
                    case "account":
                        $users->updateAccount();
                    break;
                   
                    default:
                        //nothing
                    break;
                }
            }
        }
        elseif($_GET['url'] != 'maintenance')
        {

            if($_SESSION['user']['rank'] > 6){
               
            }

            else{
            header('Location: '. $_CONFIG['hotel']['url'] .'/maintenance');
            exit;
            }
        }  
    }
   
    final public function handleCallHK($k)
    {
        global $users, $engine, $_CONFIG;
       
        if($_SESSION["in_hk"] != true)
        {
            if(isset($_SESSION['user']['id']))
            {
                if($k == 'login')
                {
                    $users->loginHK();
                }
                else
                {
                    header("Location:".$_CONFIG['hotel']['url']."/ase/login");
                    exit;
                }
            }
            else
            {
                header("Location:".$_CONFIG['hotel']['url']."/index");
                exit;
            }
        }
        else
        {
            if(!isset($k))
            {
                header("Location:".$_CONFIG['hotel']['url']."/ase/dash");
                exit;
            }
            else
            {
                if($k == 'balist')
                {
                       
                    if(isset($_GET["unban"]))
                    {
                        $user = $engine->secure($_GET["unban"]);
                        $engine->query("DELETE FROM bans WHERE id = '" . $user . "'");
                        header("Location: ".$_CONFIG['hotel']['url']."/ase/banlist");
                        exit;
                    }  
                }
            }
        }
    }
   
    final public function hashed($password)
    {
        return md5($password);
    }
}
?>
Nope
 

rent

Member
Sep 24, 2012
408
67
<?php
$getBan = mysql_query("SELECT * FROM `bans` WHERE `value` = '".$_SESSION['user']['username']."' OR `value` = '".$_SERVER['REMOTE_ADDR']."'");
if(mysql_num_rows($getBan) == 0)
{
header("Location: /me");
exit;
}

$getInfo = mysql_fetch_assoc($getBan);
if(time() > $getInfo['expire'])
{
mysql_query("DELETE FROM `bans` WHERE `value` = '".$_SESSION['user']['username']."' OR `value` = '".$_SERVER['REMOTE_ADDR']."'") or die(mysql_error());
header("Location: me");
exit;
}
?>

add this at the top of your banned.php
 

Users who are viewing this thread

Top