관리자 환경설정의 접근차단IP 중 현재 접속 IP를 차단못하게 하기
This commit is contained in:
@ -1434,6 +1434,26 @@ $(function(){
|
||||
|
||||
function fconfigform_submit(f)
|
||||
{
|
||||
var current_user_ip = "<?php echo $_SERVER['REMOTE_ADDR']; ?>";
|
||||
var cf_intercept_ip_val = f.cf_intercept_ip.value;
|
||||
|
||||
if( cf_intercept_ip_val && current_user_ip ){
|
||||
var cf_intercept_ips = cf_intercept_ip_val.split("\n");
|
||||
|
||||
for(var i=0; i < cf_intercept_ips.length; i++){
|
||||
if ( cf_intercept_ips[i].trim() ) {
|
||||
cf_intercept_ips[i] = cf_intercept_ips[i].replace(".", "\.");
|
||||
cf_intercept_ips[i] = cf_intercept_ips[i].replace("+", "[0-9\.]+");
|
||||
|
||||
var re = new RegExp(cf_intercept_ips[i]);
|
||||
if ( re.test(current_user_ip) ){
|
||||
alert("현재 접속 IP : "+ current_user_ip +" 가 차단될수 있기 때문에, 다른 IP를 입력해 주세요.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
f.action = "./config_form_update.php";
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -38,6 +38,24 @@ foreach( $check_keys as $key ){
|
||||
|
||||
$_POST['cf_icode_server_port'] = isset($_POST['cf_icode_server_port']) ? preg_replace('/[^0-9]/', '', $_POST['cf_icode_server_port']) : '7295';
|
||||
|
||||
if(isset($_POST['cf_intercept_ip']) && $_POST['cf_intercept_ip']){
|
||||
|
||||
$pattern = explode("\n", trim($_POST['cf_intercept_ip']));
|
||||
for ($i=0; $i<count($pattern); $i++) {
|
||||
$pattern[$i] = trim($pattern[$i]);
|
||||
if (empty($pattern[$i]))
|
||||
continue;
|
||||
|
||||
$pattern[$i] = str_replace(".", "\.", $pattern[$i]);
|
||||
$pattern[$i] = str_replace("+", "[0-9\.]+", $pattern[$i]);
|
||||
$pat = "/^{$pattern[$i]}$/";
|
||||
|
||||
if( preg_match($pat, $_SERVER['REMOTE_ADDR']) ){
|
||||
alert("현재 접속 IP : ".$_SERVER['REMOTE_ADDR']." 가 차단될수 있기 때문에, 다른 IP를 입력해 주세요.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql = " update {$g5['config_table']}
|
||||
set cf_title = '{$_POST['cf_title']}',
|
||||
cf_admin = '{$_POST['cf_admin']}',
|
||||
|
||||
Reference in New Issue
Block a user