로그폴더 검색되지 않도록 수정
This commit is contained in:
@ -379,6 +379,47 @@ function get_sanitize_input($s, $is_html=false){
|
||||
return $s;
|
||||
}
|
||||
|
||||
function check_log_folder($log_path){
|
||||
|
||||
if( is_writable($log_path) ){
|
||||
|
||||
// 아파치 서버인 경우 웹에서 해당 폴더 접근 막기
|
||||
$htaccess_file = $log_path.'/.htaccess';
|
||||
if ( !file_exists( $htaccess_file ) ) {
|
||||
if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
|
||||
fwrite( $handle, 'Order deny,allow' . "\n" );
|
||||
fwrite( $handle, 'Deny from all' . "\n" );
|
||||
fclose( $handle );
|
||||
}
|
||||
}
|
||||
|
||||
// 아파치 서버인 경우 해당 디렉토리 파일 목록 안보이게 하기
|
||||
$index_file = $log_path . '/index.php';
|
||||
if ( !file_exists( $index_file ) ) {
|
||||
if ( $handle = @fopen( $index_file, 'w' ) ) {
|
||||
fwrite( $handle, '' );
|
||||
fclose( $handle );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// txt 파일과 log 파일을 조회하여 30일이 지난 파일은 삭제합니다.
|
||||
$txt_files = glob($log_path.'/*.txt');
|
||||
$log_files = glob($log_path.'/*.log');
|
||||
|
||||
$del_files = array_merge($txt_files, $log_files);
|
||||
|
||||
if( $del_files && is_array($del_files) ){
|
||||
foreach ($del_files as $del_file) {
|
||||
$filetime = filemtime($del_file);
|
||||
// 30일이 지난 파일을 삭제
|
||||
if($filetime && $filetime < (G5_SERVER_TIME - 2592000)) {
|
||||
@unlink($del_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// POST로 넘어온 토큰과 세션에 저장된 토큰 비교
|
||||
function check_admin_token()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user