diff --git a/admin/modules/system/backup.php b/admin/modules/system/backup.php index 9f5aafe..e38af70 100755 --- a/admin/modules/system/backup.php +++ b/admin/modules/system/backup.php @@ -23,13 +23,11 @@ // key to authenticate define('INDEX_AUTH', '1'); -// key to get full database access -define('DB_ACCESS', 'fa'); // main system configuration require '../../../sysconfig.inc.php'; // IP based access limitation -require LIB_DIR.'ip_based_access.inc.php'; +require_once LIB_DIR.'ip_based_access.inc.php'; do_checkIP('smc'); do_checkIP('smc-system'); // start the session diff --git a/lib/ip_based_access.inc.php b/lib/ip_based_access.inc.php index a47b13b..76401bb 100644 --- a/lib/ip_based_access.inc.php +++ b/lib/ip_based_access.inc.php @@ -25,33 +25,34 @@ die("can not access this file directly"); } -function do_checkIP ($module = 'general') -{ - global $sysconf; - if (isset($sysconf['ipaccess'][''.$module.''])) { - $accmod = $sysconf['ipaccess'][''.$module.'']; - } else { - die ('Invalid access module'); - } - #$accmod = $sysconf['ipaccess'][''.$module.'']; - $is_allowed = false; - $remote_addr = $_SERVER['REMOTE_ADDR']; - if (($accmod != 'all') AND (is_array($accmod))) { - foreach ($accmod as $value) { - $pattern = "/^".$value."/i"; - if (preg_match($pattern, $remote_addr)) { - $is_allowed = true; - } +if (!function_exists('do_checkIP')) { + function do_checkIP ($module = 'general') + { + global $sysconf; + if (isset($sysconf['ipaccess'][''.$module.''])) { + $accmod = $sysconf['ipaccess'][''.$module.'']; + } else { + die ('Invalid access module'); } - } elseif ($accmod == 'all') { - $is_allowed = true; - } else { + #$accmod = $sysconf['ipaccess'][''.$module.'']; $is_allowed = false; - } - - if (!$is_allowed) { - echo 'Stop here! Access now allowed.'; - exit(); + $remote_addr = $_SERVER['REMOTE_ADDR']; + if (($accmod != 'all') AND (is_array($accmod))) { + foreach ($accmod as $value) { + $pattern = "/^".$value."/i"; + if (preg_match($pattern, $remote_addr)) { + $is_allowed = true; + } + } + } elseif ($accmod == 'all') { + $is_allowed = true; + } else { + $is_allowed = false; + } + if (!$is_allowed) { + echo 'Stop here! Access now allowed.'; + exit(); + } } }