로그폴더 검색되지 않도록 수정
This commit is contained in:
@ -379,6 +379,47 @@ function get_sanitize_input($s, $is_html=false){
|
|||||||
return $s;
|
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로 넘어온 토큰과 세션에 저장된 토큰 비교
|
// POST로 넘어온 토큰과 세션에 저장된 토큰 비교
|
||||||
function check_admin_token()
|
function check_admin_token()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -143,7 +143,7 @@ class XPayClient
|
|||||||
// log_dir 재설정
|
// log_dir 재설정
|
||||||
$this->config["log_dir"] = $home_dir."/log";
|
$this->config["log_dir"] = $home_dir."/log";
|
||||||
|
|
||||||
$this->log_file = $this->config["log_dir"] . "/log_" . date("Ymd") . ".log";
|
$this->log_file = $this->config["log_dir"] . "/log_" . date("Ymd") . '_' . substr(md5(mt_rand()), 0, 12) . ".log";
|
||||||
// make log directory if does not exist
|
// make log directory if does not exist
|
||||||
if (!file_exists($this->config["log_dir"])) {
|
if (!file_exists($this->config["log_dir"])) {
|
||||||
mkdir($this->config["log_dir"], "0777", true);
|
mkdir($this->config["log_dir"], "0777", true);
|
||||||
|
|||||||
@ -141,7 +141,7 @@ class XPayClient
|
|||||||
$array3 = array($mid => $mertkey);
|
$array3 = array($mid => $mertkey);
|
||||||
$this->config = $array1 + $array2 + $array3;
|
$this->config = $array1 + $array2 + $array3;
|
||||||
|
|
||||||
$this->log_file = $this->config["log_dir"] . "/log_" . date("Ymd") . ".log";
|
$this->log_file = $this->config["log_dir"] . "/log_" . date("Ymd") . '_' . substr(md5(mt_rand()), 0, 12) . ".log";
|
||||||
// make log directory if does not exist
|
// make log directory if does not exist
|
||||||
if (!file_exists($this->config["log_dir"])) {
|
if (!file_exists($this->config["log_dir"])) {
|
||||||
mkdir($this->config["log_dir"], "0777", true);
|
mkdir($this->config["log_dir"], "0777", true);
|
||||||
|
|||||||
Reference in New Issue
Block a user