PHP Warning count 경고문 코드 수정 및 기타 코드 수정

This commit is contained in:
thisgun
2020-06-04 17:21:40 +09:00
parent b90b15ac77
commit 426e4e2819
3 changed files with 102 additions and 95 deletions

View File

@ -6,6 +6,10 @@ include_once(G5_PATH.'/head.sub.php');
$filename = preg_replace('/[^A-Za-z0-9 _ .\-\/]/', '', $_GET['fn']); $filename = preg_replace('/[^A-Za-z0-9 _ .\-\/]/', '', $_GET['fn']);
if(function_exists('clean_relative_paths')){
$filename = clean_relative_paths($filename);
}
$extension = pathinfo($filename, PATHINFO_EXTENSION); $extension = pathinfo($filename, PATHINFO_EXTENSION);
if ( ! preg_match('/(jpg|jpeg|png|gif|bmp)$/i', $extension) ){ if ( ! preg_match('/(jpg|jpeg|png|gif|bmp)$/i', $extension) ){

View File

@ -436,7 +436,7 @@ if (!$group['gr_use_access'] && $board['bo_read_level'] < 2 && !$secret) {
// 파일개수 체크 // 파일개수 체크
$file_count = 0; $file_count = 0;
$upload_count = count($_FILES['bf_file']['name']); $upload_count = (isset($_FILES['bf_file']['name']) && is_array($_FILES['bf_file']['name'])) ? count($_FILES['bf_file']['name']) : 0;
for ($i=0; $i<$upload_count; $i++) { for ($i=0; $i<$upload_count; $i++) {
if($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i])) if($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i]))
@ -461,7 +461,9 @@ $chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));
// 가변 파일 업로드 // 가변 파일 업로드
$file_upload_msg = ''; $file_upload_msg = '';
$upload = array(); $upload = array();
for ($i=0; $i<count($_FILES['bf_file']['name']); $i++) {
if(isset($_FILES['bf_file']['name']) && is_array($_FILES['bf_file']['name'])) {
for ($i=0; $i<count($_FILES['bf_file']['name']); $i++) {
$upload[$i]['file'] = ''; $upload[$i]['file'] = '';
$upload[$i]['source'] = ''; $upload[$i]['source'] = '';
$upload[$i]['filesize'] = 0; $upload[$i]['filesize'] = 0;
@ -570,7 +572,8 @@ for ($i=0; $i<count($_FILES['bf_file']['name']); $i++) {
$dest_file = run_replace('write_update_upload_file', $dest_file, $board, $wr_id, $w); $dest_file = run_replace('write_update_upload_file', $dest_file, $board, $wr_id, $w);
$upload[$i] = run_replace('write_update_upload_array', $upload[$i], $dest_file, $board, $wr_id, $w); $upload[$i] = run_replace('write_update_upload_array', $upload[$i], $dest_file, $board, $wr_id, $w);
} }
} } // end for
} // end if
// 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다. // 나중에 테이블에 저장하는 이유는 $wr_id 값을 저장해야 하기 때문입니다.
for ($i=0; $i<count($upload); $i++) for ($i=0; $i<count($upload); $i++)

View File

@ -17,18 +17,18 @@ function make_mp3()
} }
$ip = sprintf("%u", ip2long($_SERVER['REMOTE_ADDR'])); $ip = sprintf("%u", ip2long($_SERVER['REMOTE_ADDR']));
$mp3_file = 'data/cache/kcaptcha-'.$ip.'_'.G5_SERVER_TIME.'.mp3'; $mp3_file = 'cache/kcaptcha-'.$ip.'_'.G5_SERVER_TIME.'.mp3';
$contents = ''; $contents = '';
foreach ($mp3s as $mp3) { foreach ($mp3s as $mp3) {
$contents .= file_get_contents($mp3); $contents .= file_get_contents($mp3);
} }
file_put_contents(G5_PATH.'/'.$mp3_file, $contents); file_put_contents(G5_DATA_PATH.'/'.$mp3_file, $contents);
// 지난 캡챠 파일 삭제 // 지난 캡챠 파일 삭제
if (rand(0,99) == 0) { if (rand(0,99) == 0) {
foreach (glob(G5_PATH.'/data/cache/kcaptcha-*.mp3') as $file) { foreach (glob(G5_DATA_PATH.'/cache/kcaptcha-*.mp3') as $file) {
if (filemtime($file) + 86400 < G5_SERVER_TIME) { if (filemtime($file) + 86400 < G5_SERVER_TIME) {
@unlink($file); @unlink($file);
} }