[PHP/SQL] If in maintenance, user is logged in and below a certain rank then redirect?

Modo

blame it on my asd
May 27, 2013
137
42
Hi again,

I am trying to make my retro cms allow staff members online during maintenance but haven't seen code for it anywhere. I presume it is possible as it is just a bit of SQL...

Code:
final public function handleCall($k)
    {
        global $users, $template, $_CONFIG;
      
        if($_CONFIG['hotel']['in_maint'] == false)
        {
            if(!isset($_SESSION['user']['id']))
            {
                switch($k)
                {
                    case "index":
                    case null:

Main part I'm looking at is "if(!isset($_SESSION" - if user is in session and is rank above 8 then {

Anyone?
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Code it so in maintenance you see anything but the index page, and when a user logs in if in maintenance and rank is less than the desired, then they can't login. Otherwise the register will work, but then take them to a maintenance page after registering if in maintenance.
 

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,736
1,319
Just add the code in your parent index.php
PHP:
if ($_CONFIG["in_maintenance"]) {
  if ($_SESSION['user']['rank'] < 8) {
    die(include('link-to-maintenance.php'));
  }
}
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
Just add the code in your parent index.php
PHP:
if ($_CONFIG["in_maintenance"]) {
  if ($_SESSION['user']['rank'] < 8) {
    die(include('link-to-maintenance.php'));
  }
}
Well if they are not logged in the are not assigned a session -1
 

LeChris

github.com/habbo-hotel
Sep 30, 2013
2,736
1,319
Well if they are not logged in the are not assigned a session -1
PHP:
if ($_CONFIG["in_maintenance"]) {
  if(isset($_SESSION['user'])) {
    if ($_SESSION['user']['rank'] < 8) {
      die(include('link-to-maintenance.php'));
    }
  } else {
    die(include('link-to-maintenance.php'));
  }
}
sorry not everyday i deal with rev or uber by the looks of it instead of going -1 you should learn how to perform an if statement and modify code
 

JayC

Always Learning
Aug 8, 2013
5,493
1,398
PHP:
if ($_CONFIG["in_maintenance"]) {
  if(isset($_SESSION['user'])) {
    if ($_SESSION['user']['rank'] < 8) {
      die(include('link-to-maintenance.php'));
    }
  } else {
    die(include('link-to-maintenance.php'));
  }
}
sorry not everyday i deal with rev or uber by the looks of it instead of going -1 you should learn how to perform an if statement and modify code
I've been on my phone and cba to bother because I'm trying to renovate my room so my laptop is lost atm. Sorry :)
 

Users who are viewing this thread

Top