Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
1:1문의 파일업로드 분류 체크 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
chicpro committed May 4, 2016
1 parent ff9f9f2 commit 0a3f389
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions bbs/qawrite_update.php
Expand Up @@ -15,6 +15,14 @@
// 1:1문의 설정값
$qaconfig = get_qa_config();

if(trim($qaconfig['qa_category'])) {
$category = explode('|', $qaconfig['qa_category']);
if(!in_array($qa_category, $category))
alert('분류를 올바르게 지정해 주십시오.');
} else {
alert('1:1문의 설정에서 분류를 설정해 주십시오');
}

// e-mail 체크
$qa_email = '';
if(isset($_POST['qa_email']) && $_POST['qa_email'])
Expand Down Expand Up @@ -102,6 +110,18 @@
}
}

// 파일개수 체크
$file_count = 0;
$upload_count = count($_FILES['bf_file']['name']);

for ($i=1; $i<=$upload_count; $i++) {
if($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i]))
$file_count++;
}

if($file_count > 2)
alert('첨부파일을 2개 이하로 업로드 해주십시오.');

// 디렉토리가 없다면 생성합니다. (퍼미션도 변경하구요.)
@mkdir(G5_DATA_PATH.'/qa', G5_DIR_PERMISSION);
@chmod(G5_DATA_PATH.'/qa', G5_DIR_PERMISSION);
Expand Down

0 comments on commit 0a3f389

Please sign in to comment.