execute("SELECT `ban_ip` FROM `db_banlist` WHERE `ban_active`='1';"); if ($q->fields['ban_ip']) { while (!$q->EOF) { $check = (VIPrange::ip_in_range($ip, $q->fields['ban_ip']) == 1) ? 1 : 0; if ($check == 1) {return $check;} @$q->MoveNext(); } } return $check; } public static function banIPrange_single($ip, $range) { return $check = (VIPrange::ip_in_range($ip, $range) == 1) ? 1 : 0; } /* section access based on ip lists */ public static function sectionAccess($backend_access_url) { global $class_database, $class_filter, $cfg, $section; $u = $_SERVER['REQUEST_URI']; $_section = (strstr($u, $backend_access_url) == true) ? 'backend' : 'frontend'; if ($u == '' || strpos($u, VHref::getKey('publish')) !== false || strpos($u, VHref::getKey('publish_done')) !== false || strpos($u, VHref::getKey('record_done')) !== false) { return; } /* offline mode */ if ($_section == 'frontend' and $cfg['website_offline_mode'] == 1 and $section != VHref::getKey("soon") and !isset($_SESSION['ADMIN_NAME'])) { header("Location:" . $cfg['main_url'] . '/' . VHref::getKey("soon")); exit; } /* check for banned IP */ $ip = $class_filter->clr_str(self::getUserIP()); $ip_ban = $class_database->singleFieldValue('db_banlist', 'ban_active', 'ban_ip', $ip); $ip_range = self::banIPrange_db($ip); if ($ip_ban == 1 or $ip_range == 1) { $fe_access = 0; } else { /* check IP from lists */ if ($_SERVER['REQUEST_URI'] == '') { return false; } $cfg = $class_database->getConfigurations('website_ip_based_access,list_ip_access,backend_ip_based_access,list_ip_backend'); $fe_access = ($cfg['website_ip_based_access'] == 1 and !self::checkIPlist($cfg['list_ip_access'])) ? 0 : 1; $be_access = ($cfg['backend_ip_based_access'] == 1 and !self::checkIPlist($cfg['list_ip_backend'])) ? 0 : 1; } $fe_error = ($fe_access == 0 and $_section == 'frontend') ? die('