Merge branch 'g5'

This commit is contained in:
chicpro
2014-03-18 15:36:58 +09:00
3 changed files with 23 additions and 11 deletions

View File

@ -69,21 +69,21 @@ if (file_exists($dbconfig_file)) {
if (defined(G5_TIMEZONE)) @mysql_query(" set time_zone = '".G5_TIMEZONE."'");
//==============================================================================
// SQL Injection 등으로 부터 보호를 위해 mysql_real_escape_string() 적용
// SQL Injection 등으로 부터 보호를 위해 sql_escape_string() 적용
//------------------------------------------------------------------------------
// magic_quotes_gpc 에 의한 backslashes 제거
if (get_magic_quotes_gpc()) {
$_POST = array_map_deep('stripslashes', $_POST);
$_GET = array_map_deep('stripslashes', $_GET);
$_COOKIE = array_map_deep('stripslashes', $_COOKIE);
$_REQUEST = array_map_deep('stripslashes', $_REQUEST);
$_POST = array_map_deep('stripslashes', $_POST);
$_GET = array_map_deep('stripslashes', $_GET);
$_COOKIE = array_map_deep('stripslashes', $_COOKIE);
$_REQUEST = array_map_deep('stripslashes', $_REQUEST);
}
// mysql_real_escape_string 적용
$_POST = array_map_deep(G5_ESCAPE_FUNCTION, $_POST);
$_GET = array_map_deep(G5_ESCAPE_FUNCTION, $_GET);
$_COOKIE = array_map_deep(G5_ESCAPE_FUNCTION, $_COOKIE);
$_REQUEST = array_map_deep(G5_ESCAPE_FUNCTION, $_REQUEST);
// sql_escape_string 적용
$_POST = array_map_deep('sql_escape_string', $_POST);
$_GET = array_map_deep('sql_escape_string', $_GET);
$_COOKIE = array_map_deep('sql_escape_string', $_COOKIE);
$_REQUEST = array_map_deep('sql_escape_string', $_REQUEST);
//==============================================================================
// PHP 4.1.0 부터 지원됨

View File

@ -153,7 +153,7 @@ if (G5_IS_MOBILE) {
<?php
}
if ($i == 0) { ?><li class="gnb_empty">생성된 메뉴가 없습니다.</li><?php }
if ($i == 0) { ?><li class="gnb_empty">메뉴 준비 중입니다.<?php if ($is_admin) { ?> (<a href="<?php echo G5_ADMIN_URL; ?>/menu_list.php">관리자모드 &gt; 환경설정 &gt; 메뉴설정</a>에서 설정하실 수 있습니다.)<?php } ?></li><?php }
?>
</ul>
</nav>

View File

@ -25,6 +25,18 @@ function array_map_deep($fn, $array)
return $array;
}
// SQL Injection 대응 문자열 필터링
function sql_escape_string($str)
{
$pattern = '/(and|or).*(union|select|insert|update|delete|from|where|limit|create|drop).*/i';
$replace = '';
$str = preg_replace($pattern, $replace, $str);
$str = call_user_func(G5_ESCAPE_FUNCTION, $str);
return $str;
}
// 마이크로 타임을 얻어 계산 형식으로 만듦
function get_microtime()
{