안녕하세요.
php7으로 변경후
Copy
<?/* 댓글첨부파일 처리 */ $file_upload_msg = "";$upload = array();$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));$wr_id = $comment_id;$i = 0; // 삭제에 체크가 되어있다면 파일을 삭제합니다. if ($_POST[wr_commentfile_del]) { $upload[$i][del_check] = true; $row = sql_fetch(" select bf_file from $g5[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "); @unlink("$g5[path]/data/file/$bo_table/$row[bf_file]"); $sql = " delete from $g5[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "; sql_query($sql); } else $upload[$i][del_check] = false; $tmp_file = $_FILES[wr_commentfile][tmp_name]; $filename = $_FILES[wr_commentfile][name]; $filesize = $_FILES[wr_commentfile][size]; // 서버에 설정된 값보다 큰파일을 업로드 한다면 if ($filename) { if ($_FILES[wr_commentfile][error] == 1) { $file_upload_msg .= "\'{$filename}\' 파일의 용량이 서버에 설정($upload_max_filesize)된 값보다 크므로 업로드 할 수 없습니다.\\n"; continue; } else if ($_FILES[wr_commentfile][error] != 0) { $file_upload_msg .= "\'{$filename}\' 파일이 정상적으로 업로드 되지 않았습니다.\\n"; continue; } } if (is_uploaded_file($tmp_file)) { // 관리자가 아니면서 설정한 업로드 사이즈보다 크다면 건너뜀 if (!$is_admin && $filesize > $board[bo_upload_size]) { $file_upload_msg .= "\'{$filename}\' 파일의 용량(".number_format($filesize)." 바이트)이 게시판에 설정(".number_format($board[bo_upload_size])." 바이트)된 값보다 크므로 업로드 하지 않습니다.\\n"; continue; } //=================================================================\ // 090714 // 이미지나 플래시 파일에 악성코드를 심어 업로드 하는 경우를 방지 // 에러메세지는 출력하지 않는다. //----------------------------------------------------------------- $timg = @getimagesize($tmp_file); // image type if ( preg_match("/\.($config[cf_image_extension])$/i", $filename) || preg_match("/\.($config[cf_flash_extension])$/i", $filename) ) { if ($timg[2] < 1 || $timg[2] > 16) { //$file_upload_msg .= "\'{$filename}\' 파일이 이미지나 플래시 파일이 아닙니다.\\n"; continue; } } //================================================================= $upload[$i][image] = $timg; // 4.00.11 - 글답변에서 파일 업로드시 원글의 파일이 삭제되는 오류를 수정 if ($w == 'u') { // 존재하는 파일이 있다면 삭제합니다. $row = sql_fetch(" select bf_file from $g5[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "); @unlink("$g5[path]/data/file/$bo_table/$row[bf_file]"); } // 프로그램 원래 파일명 $upload[$i][source] = $filename; $upload[$i][filesize] = $filesize; // 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함 $filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename); // 접미사를 붙인 파일명 //$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g5[server_time])),0,8).'_'.urlencode($filename); // 달빛온도님 수정 : 한글파일은 urlencode($filename) 처리를 할경우 '%'를 붙여주게 되는데 '%'표시는 미디어플레이어가 인식을 못하기 때문에 재생이 안됩니다. 그래서 변경한 파일명에서 '%'부분을 빼주면 해결됩니다. //$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr(md5(uniqid($g5[server_time])),0,8).'_'.str_replace('%', '', urlencode($filename)); shuffle($chars_array); $shuffle = implode("", $chars_array); // 첨부파일 첨부시 첨부파일명에 공백이 포함되어 있으면 일부 PC에서 보이지 않거나 다운로드 되지 않는 현상이 있습니다. (길상여의 님 090925) //$upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode($filename)); $upload[$i][file] = abs(ip2long($_SERVER[REMOTE_ADDR])).'_'.substr($shuffle,0,8).'_'.str_replace('%', '', urlencode(str_replace(' ', '_', $filename))); $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/' . $upload[$i][file]; // 업로드가 안된다면 에러메세지 출력하고 죽어버립니다. $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES[wr_commentfile][error]); // 올라간 파일의 퍼미션을 변경합니다. chmod($dest_file, 0606); //$upload[$i][image] = @getimagesize($dest_file); if (!get_magic_quotes_gpc()) { $upload[$i]['source'] = addslashes($upload[$i]['source']); } $row = sql_fetch(" select count(*) as cnt from $g5[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "); if ($row[cnt]) { // 삭제에 체크가 있거나 파일이 있다면 업데이트를 합니다. // 그렇지 않다면 내용만 업데이트 합니다. if ( $upload[$i][file]) { $sql = " update $g5[board_file_table] set bf_source = '{$upload[$i][source]}', bf_file = '{$upload[$i][file]}', bf_content = '{$bf_content[$i]}', bf_filesize = '{$upload[$i][filesize]}', bf_width = '{$upload[$i][image][0]}', bf_height = '{$upload[$i][image][1]}', bf_type = '{$upload[$i][image][2]}', bf_datetime = '$g5[time_ymdhis]' where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "; sql_query($sql); }else { $sql = " update $g5[board_file_table] set bf_content = '{$bf_content[$i]}' where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '$i' "; sql_query($sql); } } else { $sql = " insert into $g5[board_file_table] set bo_table = '$bo_table', wr_id = '$wr_id', bf_no = '$i', bf_source = '{$upload[$i][source]}', bf_file = '{$upload[$i][file]}', bf_content = '{$bf_content[$i]}', bf_download = 0, bf_filesize = '{$upload[$i][filesize]}', bf_width = '{$upload[$i][image][0]}', bf_height = '{$upload[$i][image][1]}', bf_type = '{$upload[$i][image][2]}', bf_datetime = '$g5[time_ymdhis]' "; sql_query($sql); } } ?>
이 부분이
안먹히는데 어디가 잘못된걸까요?ㅠ
답변 3개 / 댓글 2개
2017-03-06 (월) 16:05:47
continue;
이부분 때문인거 같습니다..
어떻게 해결을 해야될까요
2017-03-06 (월) 15:11:10
에러메세지가 라인 표시해줄텐데여
해당 라인가서 함수 수정해야댈듯싶습니다.
7로 되면서 변경된 함수 등이 있어여
답변에 대한 댓글 1개
2017-03-06 (월) 15:19:59
2017-03-06 (월) 15:10:18
시작부분 <? -> <?php 로 한번 바꿔 보신 후 확인해 보세요
답변에 대한 댓글 1개
답변을 작성하려면 로그인이 필요합니다.
현재 www.xxx.com에서 요청을 처리할 수 없습니다.
HTTP ERROR 500
글을 적고 등록을 하면
이렇게 떠요 ㅠ
글을 올라가 잇습니다 ㅠ
텍스트만