mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 19:51:42 +09:00
Apply admin ip check
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9111 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
af4c27f832
commit
f00e0618ec
3 changed files with 36 additions and 1 deletions
|
|
@ -30,8 +30,10 @@
|
|||
<action name="getModuleAdminLangCode" type="model" standalone="true" />
|
||||
<action name="getModuleAdminLangListByName" type="model" standalone="true" />
|
||||
<action name="getModuleAdminLangListByValue" type="model" standalone="true" />
|
||||
<action name="getModuleAdminIPCheck" type="model" standalone="true" />
|
||||
<action name="getLangListByLangcodeForAutoComplete" type="model" standalone="true" />
|
||||
<action name="getFileBoxListHtml" type="model" />
|
||||
|
||||
|
||||
<action name="procModuleAdminInsertCategory" type="controller" standalone="true" ruleset="insertCategory" />
|
||||
<action name="procModuleAdminUpdateCategory" type="controller" standalone="true" ruleset="updateCategory" />
|
||||
|
|
|
|||
|
|
@ -261,5 +261,32 @@
|
|||
|
||||
return $this->getLangListByLangcode($args);
|
||||
}
|
||||
function getModuleAdminIPCheck() {
|
||||
|
||||
$db_info = Context::getDBInfo();
|
||||
$admin_ip = $db_info->admin_ip;
|
||||
|
||||
if(preg_match('/^(\d{1,3}(?:.(\d{1,3}|\*)){3})$/', $admin_ip, $matches)) {
|
||||
if(!empty($_SERVER['HTTP_CLIENT_IP']) && getenv('HTTP_CLIENT_IP')){
|
||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||
}
|
||||
else if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && getenv('HTTP_X_FORWARDED_FOR')){
|
||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
}
|
||||
else if(!empty($_SERVER['REMOTE_HOST']) && getenv('REMOTE_HOST')){
|
||||
$ip = $_SERVER['REMOTE_HOST'];
|
||||
}
|
||||
else if(!empty($_SERVER['REMOTE_ADDR']) && getenv('REMOTE_ADDR')){
|
||||
$ip = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
if($ip) {
|
||||
$admin_ip = str_replace('*','',$admin_ip);
|
||||
$admin_ip_patterns[] = preg_quote($admin_ip);
|
||||
$admin_ip_pattern = '/^('.implode($admin_ip_patterns,'|').')/';
|
||||
if(!preg_match($admin_ip_pattern, $ip, $matches)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue