HTTP 500 오류

HTTP 500 오류

QA

HTTP 500 오류

본문

게시판에 글을 쓰고 수정 또는 저장을 하면 HTTP 500 오류가 뜹니다. 해결법좀.

그리고 덤으로 댓글 쓰면 올바른 방법으로 이용 뜸니다 해결법좀 주세요.ㅠ.ㅠ

 

<?php

include_once('./_common.php');

include_once(G5_LIB_PATH.'/naver_syndi.lib.php');

include_once(G5_CAPTCHA_PATH.'/captcha.lib.php');

 

// ?좏겙泥댄겕

check_write_token($bo_table);

 

$g5['title'] = '寃뚯떆湲 ???;

 

$msg = array();

 

if($board['bo_use_category']) {

    $ca_name = trim($_POST['ca_name']);

    if(!$ca_name) {

        $msg[] = '<strong>遺꾨쪟</strong>瑜??좏깮?섏꽭??';

    } else {

        $categories = array_map('trim', explode("|", $board['bo_category_list'].($is_admin ? '|怨듭?' : '')));

        if(!empty($categories) && !in_array($ca_name, $categories))

            $msg[] = '遺꾨쪟瑜??щ컮瑜닿쾶 ?낅젰?섏꽭??';

 

        if(empty($categories))

            $ca_name = '';

    }

} else {

    $ca_name = '';

}

 

$wr_subject = '';

if (isset($_POST['wr_subject'])) {

    $wr_subject = substr(trim($_POST['wr_subject']),0,255);

    $wr_subject = preg_replace("#[\\\]+$#", "", $wr_subject);

}

if ($wr_subject == '') {

    $msg[] = '<strong>?쒕ぉ</strong>???낅젰?섏꽭??';

}

 

$wr_content = '';

if (isset($_POST['wr_content'])) {

    $wr_content = substr(trim($_POST['wr_content']),0,65536);

    $wr_content = preg_replace("#[\\\]+$#", "", $wr_content);

}

if ($wr_content == '') {

    $msg[] = '<strong>?댁슜</strong>???낅젰?섏꽭??';

}

 

$wr_link1 = '';

if (isset($_POST['wr_link1'])) {

    $wr_link1 = substr($_POST['wr_link1'],0,1000);

    $wr_link1 = trim(strip_tags($wr_link1));

    $wr_link1 = preg_replace("#[\\\]+$#", "", $wr_link1);

}

 

$wr_link2 = '';

if (isset($_POST['wr_link2'])) {

    $wr_link2 = substr($_POST['wr_link2'],0,1000);

    $wr_link2 = trim(strip_tags($wr_link2));

    $wr_link2 = preg_replace("#[\\\]+$#", "", $wr_link2);

}

 

$msg = implode('<br>', $msg);

if ($msg) {

    alert($msg);

}

 

// 090710

if (substr_count($wr_content, '') > 50) {

    alert('?댁슜???щ컮瑜댁? ?딆? 肄붾뱶媛 ?ㅼ닔 ?ы븿?섏뼱 ?덉뒿?덈떎.');

    exit;

}

 

$upload_max_filesize = ini_get('upload_max_filesize');

 

if (empty($_POST)) {

    alert("?뚯씪 ?먮뒗 湲?댁슜???ш린媛 ?쒕쾭?먯꽌 ?ㅼ젙??媛믪쓣 ?섏뼱 ?ㅻ쪟媛 諛쒖깮?섏??듬땲??\\npost_max_size=".ini_get('post_max_size')." , upload_max_filesize=".$upload_max_filesize."\\n寃뚯떆?먭?由ъ옄 ?먮뒗 ?쒕쾭愿由ъ옄?먭쾶 臾몄쓽 諛붾엻?덈떎.");

}

 

$notice_array = explode(",", $board['bo_notice']);

 

if ($w == 'u' || $w == 'r') {

    $wr = get_write($write_table, $wr_id);

    if (!$wr['wr_id']) {

        alert("湲??議댁옱?섏? ?딆뒿?덈떎.\\n湲????젣?섏뿀嫄곕굹 ?대룞?섏??????덉뒿?덈떎.");

    }

}

 

// ?몃??먯꽌 湲???깅줉?????덈뒗 踰꾧렇媛 議댁옱?섎?濡?鍮꾨?湲? ?ъ슜??寃쎌슦?먮쭔 媛?ν빐????

if (!$is_admin && !$board['bo_use_secret'] && (stripos($_POST['html'], 'secret') !== false || stripos($_POST['secret'], 'secret') !== false || stripos($_POST['mail'], 'secret') !== false)) {

alert('鍮꾨?湲 誘몄궗??寃뚯떆???대?濡?鍮꾨?湲濡??깅줉?????놁뒿?덈떎.');

}

 

$secret = '';

if (isset($_POST['secret']) && $_POST['secret']) {

    if(preg_match('#secret#', strtolower($_POST['secret']), $matches))

        $secret = $matches[0];

}

 

// ?몃??먯꽌 湲???깅줉?????덈뒗 踰꾧렇媛 議댁옱?섎?濡?鍮꾨?湲 臾댁“嫄??ъ슜?쇰븣??愿由ъ옄瑜??쒖쇅(怨듭?)?섍퀬 臾댁“嫄?鍮꾨?湲濡??깅줉

if (!$is_admin && $board['bo_use_secret'] == 2) {

    $secret = 'secret';

}

 

$html = '';

if (isset($_POST['html']) && $_POST['html']) {

    if(preg_match('#html(1|2)#', strtolower($_POST['html']), $matches))

        $html = $matches[0];

}

 

$mail = '';

if (isset($_POST['mail']) && $_POST['mail']) {

    if(preg_match('#mail#', strtolower($_POST['mail']), $matches))

        $mail = $matches[0];

}

 

$notice = '';

if (isset($_POST['notice']) && $_POST['notice']) {

    $notice = $_POST['notice'];

}

 

for ($i=1; $i<=10; $i++) {

    $var = "wr_$i";

    $$var = "";

    if (isset($_POST['wr_'.$i]) && settype($_POST['wr_'.$i], 'string')) {

        $$var = trim($_POST['wr_'.$i]);

    }

}

 

@include_once($board_skin_path.'/write_update.head.skin.php');

 

if ($w == '' || $w == 'u') {

 

    // 源?좎슜 1.00 : 湲?곌린 沅뚰븳怨??섏젙? 蹂꾨룄濡?泥섎━?섏뼱????

    if($w =='u' && $member['mb_id'] && $wr['mb_id'] == $member['mb_id']) {

        ;

    } else if ($member['mb_level'] < $board['bo_write_level']) {

        alert('湲????沅뚰븳???놁뒿?덈떎.');

    }

 

// ?몃??먯꽌 湲???깅줉?????덈뒗 踰꾧렇媛 議댁옱?섎?濡?怨듭???愿由ъ옄留??깅줉??媛?ν빐????

if (!$is_admin && $notice) {

alert('愿由ъ옄留?怨듭??????덉뒿?덈떎.');

    }

 

} else if ($w == 'r') {

 

    if (in_array((int)$wr_id, $notice_array)) {

        alert('怨듭??먮뒗 ?듬? ?????놁뒿?덈떎.');

    }

 

    if ($member['mb_level'] < $board['bo_reply_level']) {

        alert('湲???듬???沅뚰븳???놁뒿?덈떎.');

    }

 

    // 寃뚯떆湲 諛곗뿴 李몄“

    $reply_array = &$wr;

 

    // 理쒕? ?듬?? ?뚯씠釉붿뿉 ?≪븘?볦? wr_reply ?ъ씠利덈쭔?쇰쭔 媛?ν빀?덈떎.

    if (strlen($reply_array['wr_reply']) == 10) {

        alert("???댁긽 ?듬??섏떎 ???놁뒿?덈떎.\\n?듬?? 10?④퀎 源뚯?留?媛?ν빀?덈떎.");

    }

 

    $reply_len = strlen($reply_array['wr_reply']) + 1;

    if ($board['bo_reply_order']) {

        $begin_reply_char = 'A';

        $end_reply_char = 'Z';

        $reply_number = +1;

        $sql = " select MAX(SUBSTRING(wr_reply, $reply_len, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' ";

    } else {

        $begin_reply_char = 'Z';

        $end_reply_char = 'A';

        $reply_number = -1;

        $sql = " select MIN(SUBSTRING(wr_reply, {$reply_len}, 1)) as reply from {$write_table} where wr_num = '{$reply_array['wr_num']}' and SUBSTRING(wr_reply, {$reply_len}, 1) <> '' ";

    }

    if ($reply_array['wr_reply']) $sql .= " and wr_reply like '{$reply_array['wr_reply']}%' ";

    $row = sql_fetch($sql);

 

    if (!$row['reply']) {

        $reply_char = $begin_reply_char;

    } else if ($row['reply'] == $end_reply_char) { // A~Z? 26 ?낅땲??

        alert("???댁긽 ?듬??섏떎 ???놁뒿?덈떎.\\n?듬?? 26媛?源뚯?留?媛?ν빀?덈떎.");

    } else {

        $reply_char = chr(ord($row['reply']) + $reply_number);

    }

 

    $reply = $reply_array['wr_reply'] . $reply_char;

 

} else {

    alert('w 媛믪씠 ?쒕?濡??섏뼱?ㅼ? ?딆븯?듬땲??');

}

 

if ($is_guest && !chk_captcha()) {

    alert('?먮룞?깅줉諛⑹? ?レ옄媛 ??몄뒿?덈떎.');

}

 

if ($w == '' || $w == 'r') {

    if (isset($_SESSION['ss_datetime'])) {

        if ($_SESSION['ss_datetime'] >= (G5_SERVER_TIME - $config['cf_delay_sec']) && !$is_admin)

            alert('?덈Т 鍮좊Ⅸ ?쒓컙?댁뿉 寃뚯떆臾쇱쓣 ?곗냽?댁꽌 ?щ┫ ???놁뒿?덈떎.');

    }

 

    set_session("ss_datetime", G5_SERVER_TIME);

}

 

if (!isset($_POST['wr_subject']) || !trim($_POST['wr_subject']))

    alert('?쒕ぉ???낅젰?섏뿬 二쇱떗?쒖삤.');

 

if ($w == '' || $w == 'r') {

 

    if ($member['mb_id']) {

        $mb_id = $member['mb_id'];

        $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick']));

        $wr_password = $member['mb_password'];

        $wr_email = addslashes($member['mb_email']);

        $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage']));

    } else {

        $mb_id = '';

        // 鍮꾪쉶?먯쓽 寃쎌슦 ?대쫫???꾨씫?섎뒗 寃쎌슦媛 ?덉쓬

        $wr_name = clean_xss_tags(trim($_POST['wr_name']));

        if (!$wr_name)

            alert('?대쫫? ?꾪엳 ?낅젰?섏뀛???⑸땲??');

        $wr_password = get_encrypt_string($wr_password);

        $wr_email = get_email_address(trim($_POST['wr_email']));

        $wr_homepage = clean_xss_tags($wr_homepage);

    }

 

    if ($w == 'r') {

        // ?듬????먭???鍮꾨?湲?대씪硫?鍮꾨?踰덊샇???먭?怨??숈씪?섍쾶 ?k뒗??

        if ($secret)

            $wr_password = $wr['wr_password'];

 

        $wr_id = $wr_id . $reply;

        $wr_num = $write['wr_num'];

        $wr_reply = $reply;

    } else {

        $wr_num = get_next_num($write_table);

        $wr_reply = '';

    }

 

    $sql = " insert into $write_table

                set wr_num = '$wr_num',

                     wr_reply = '$wr_reply',

                     wr_comment = 0,

                     ca_name = '$ca_name',

                     wr_option = '$html,$secret,$mail',

                     wr_subject = '$wr_subject',

                     wr_content = '$wr_content',

                     wr_link1 = '$wr_link1',

                     wr_link2 = '$wr_link2',

                     wr_link1_hit = 0,

                     wr_link2_hit = 0,

                     wr_hit = 0,

                     wr_good = 0,

                     wr_nogood = 0,

                     mb_id = '{$member['mb_id']}',

                     wr_password = '$wr_password',

                     wr_name = '$wr_name',

                     wr_email = '$wr_email',

                     wr_homepage = '$wr_homepage',

                     wr_datetime = '".G5_TIME_YMDHIS."',

                     wr_last = '".G5_TIME_YMDHIS."',

                     wr_ip = '{$_SERVER['REMOTE_ADDR']}',

                     wr_1 = '$wr_1',

                     wr_2 = '$wr_2',

                     wr_3 = '$wr_3',

                     wr_4 = '$wr_4',

                     wr_5 = '$wr_5',

                     wr_6 = '$wr_6',

                     wr_7 = '$wr_7',

                     wr_8 = '$wr_8',

                     wr_9 = '$wr_9',

                     wr_10 = '$wr_10' ";

    sql_query($sql);

 

    $wr_id = sql_insert_id();

 

    // 遺紐??꾩씠?붿뿉 UPDATE

    sql_query(" update $write_table set wr_parent = '$wr_id' where wr_id = '$wr_id' ");

 

    // ?덇? INSERT

    sql_query(" insert into {$g5['board_new_table']} ( bo_table, wr_id, wr_parent, bn_datetime, mb_id ) values ( '{$bo_table}', '{$wr_id}', '{$wr_id}', '".G5_TIME_YMDHIS."', '{$member['mb_id']}' ) ");

 

    // 寃뚯떆湲 1 利앷?

    sql_query("update {$g5['board_table']} set bo_count_write = bo_count_write + 1 where bo_table = '{$bo_table}'");

 

    // ?곌린 ?ъ씤??遺??

    if ($w == '') {

        if ($notice) {

            $bo_notice = $wr_id.($board['bo_notice'] ? ",".$board['bo_notice'] : '');

            sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");

        }

 

        insert_point($member['mb_id'], $board['bo_write_point'], "{$board['bo_subject']} {$wr_id} 湲?곌린", $bo_table, $wr_id, '?곌린');

    } else {

        // ?듬?? 肄붾찘???ъ씤?몃? 遺?ы븿

        // ?듬? ?ъ씤?멸? 留롮? 寃쎌슦 肄붾찘??????듬????섎뒗 寃쎌슦媛 留롮쓬

        insert_point($member['mb_id'], $board['bo_comment_point'], "{$board['bo_subject']} {$wr_id} 湲?듬?", $bo_table, $wr_id, '?곌린');

    }

  }  else if ($w == 'u') {

    /*

    if (get_session('ss_bo_table') != $_POST['bo_table'] || get_session('ss_wr_id') != $_POST['wr_id']) {

        alert('올바른 방법으로 수정하여 주십시오.', G5_BBS_URL.'/board.php?bo_table='.$bo_table);

    } 

    */

    $return_url = './board.php?bo_table='.$bo_table.'&wr_id='.$wr_id;

 

    if ($is_admin == 'super') // 理쒓퀬愿由ъ옄 ?듦낵

        ;

    else if ($is_admin == 'group') { // 洹몃9愿由ъ옄

        $mb = get_member($write['mb_id']);

        if ($member['mb_id'] != $group['gr_admin']) // ?먯떊??愿由ы븯??洹몃9?멸??

            alert('?먯떊??愿由ы븯??洹몃9??寃뚯떆?먯씠 ?꾨땲誘濡??섏젙?????놁뒿?덈떎.', $return_url);

        else if ($member['mb_level'] < $mb['mb_level']) // ?먯떊???덈꺼???ш굅??媛숇떎硫??듦낵

            alert('?먯떊??沅뚰븳蹂대떎 ?믪? 沅뚰븳???뚯썝???묒꽦??湲? ?섏젙?????놁뒿?덈떎.', $return_url);

    } else if ($is_admin == 'board') { // 寃뚯떆?먭?由ъ옄?대㈃

        $mb = get_member($write['mb_id']);

        if ($member['mb_id'] != $board['bo_admin']) // ?먯떊??愿由ы?섎뒗 寃뚯떆?먯씤媛?

            alert('?먯떊??愿由ы븯??寃뚯떆?먯씠 ?꾨땲誘濡??섏젙?????놁뒿?덈떎.', $return_url);

        else if ($member['mb_level'] < $mb['mb_level']) // ?먯떊???덈꺼???ш굅??媛숇떎硫??듦낵

            alert('?먯떊??沅뚰븳蹂대떎 ?믪? 沅뚰븳???뚯썝???묒꽦??湲? ?섏젙?????놁뒿?덈떎.', $return_url);

    } else if ($member['mb_id']) {

        if ($member['mb_id'] != $write['mb_id'])

            alert('?먯떊??湲???꾨땲誘???섏젙?????놁뒿?덈떎.', $return_url);

    } else {

        if ($write['mb_id'])

            alert('濡쒓렇?????섏젙?섏꽭??', './login.php?url='.urlencode($return_url));

    }

 

    if ($member['mb_id']) {

        // ?먯떊??湲?대씪硫?

        if ($member['mb_id'] == $wr['mb_id']) {

            $mb_id = $member['mb_id'];

            $wr_name = addslashes(clean_xss_tags($board['bo_use_name'] ? $member['mb_name'] : $member['mb_nick']));

            $wr_email = addslashes($member['mb_email']);

            $wr_homepage = addslashes(clean_xss_tags($member['mb_homepage']));

        } else {

            $mb_id = $wr['mb_id'];

            if(isset($_POST['wr_name']) && $_POST['wr_name'])

                $wr_name = clean_xss_tags(trim($_POST['wr_name']));

            else

                $wr_name = addslashes(clean_xss_tags($wr['wr_name']));

            if(isset($_POST['wr_email']) && $_POST['wr_email'])

                $wr_email = get_email_address(trim($_POST['wr_email']));

            else

                $wr_email = addslashes($wr['wr_email']);

            if(isset($_POST['wr_homepage']) && $_POST['wr_homepage'])

                $wr_homepage = addslashes(clean_xss_tags($_POST['wr_homepage']));

            else

                $wr_homepage = addslashes(clean_xss_tags($wr['wr_homepage']));

        }

    } else {

        $mb_id = "";

        // 鍮꾪쉶?먯쓽 寃쎌슦 ?대쫫???꾨씫?섎뒗 寃쎌슦媛 ?덉쓬

        if (!trim($wr_name)) alert("?대쫫? ?꾪엳 ?낅젰?섏뀛?????덈떎.");

        $wr_name = clean_xss_tags(trim($_POST['wr_name']));

        $wr_email = get_email_address(trim($_POST['wr_email']));

    }

 

    $sql_password = $wr_password ? " , wr_password = '".get_encrypt_string($wr_password)."' " : "";

 

    $sql_ip = '';

    if (!$is_admin)

        $sql_ip = " , wr_ip = '{$_SERVER['REMOTE_ADDR']}' ";

 

    $sql = " update {$write_table}

                set ca_name = '{$ca_name}',

                     wr_option = '{$html},{$secret},{$mail}',

                     wr_subject = '{$wr_subject}',

                     wr_content = '{$wr_content}',

                     wr_link1 = '{$wr_link1}',

                     wr_link2 = '{$wr_link2}',

                     mb_id = '{$mb_id}',

                     wr_name = '{$wr_name}',

                     wr_email = '{$wr_email}',

                     wr_homepage = '{$wr_homepage}',

                     wr_1 = '{$wr_1}',

                     wr_2 = '{$wr_2}',

                     wr_3 = '{$wr_3}',

                     wr_4 = '{$wr_4}',

                     wr_5 = '{$wr_5}',

                     wr_6 = '{$wr_6}',

                     wr_7 = '{$wr_7}',

                     wr_8 = '{$wr_8}',

                     wr_9 = '{$wr_9}',

                     wr_10= '{$wr_10}'

                     {$sql_ip}

                     {$sql_password}

              where wr_id = '{$wr['wr_id']}' ";

    sql_query($sql);

 

    // 遺꾨쪟媛 ?섏젙?섎뒗 寃쎌슦 ?대떦?섎뒗 肄붾찘?몄쓽 遺꾨쪟紐낅룄 紐⑤몢 ?섏젙??

    // 肄붾찘?몄쓽 遺꾨쪟瑜??섏젙?섏? ?딆쑝硫?寃?됱씠 ?쒕?濡??섏? ?딆쓬

    $sql = " update {$write_table} set ca_name = '{$ca_name}' where wr_parent = '{$wr['wr_id']}' ";

    sql_query($sql);

 

    /*

    if ($notice) {

        //if (!preg_match("/[^0-9]{0,1}{$wr_id}[\r]{0,1}/",$board['bo_notice']))

        if (!in_array((int)$wr_id, $notice_array)) {

            $bo_notice = $wr_id . ',' . $board['bo_notice'];

            sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");

        }

    } else {

        $bo_notice = '';

        for ($i=0; $i<count($notice_array); $i++)

            if ((int)$wr_id != (int)$notice_array[$i])

                $bo_notice .= $notice_array[$i] . ',';

        $bo_notice = trim($bo_notice);

        //$bo_notice = preg_replace("/^".$wr_id."[\n]?$/m", "", $board['bo_notice']);

        sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");

    }

    */

 

    $bo_notice = board_notice($board['bo_notice'], $wr_id, $notice);

    sql_query(" update {$g5['board_table']} set bo_notice = '{$bo_notice}' where bo_table = '{$bo_table}' ");

}

 

// 寃뚯떆?먭렇猷뱀젒洹쇱궗?⑹쓣 ?섏? ?딆븘???섍퀬 鍮꾪쉶??湲?쎄린媛 媛?ν빐???섎ʼn 鍮꾨?湲???꾨땲?댁빞 ?⑸땲??

if (!$group['gr_use_access'] && $board['bo_read_level'] < 2 && !$secret) {

    naver_syndi_ping($bo_table, $wr_id);

}

 

// ?뚯씪媛쒖닔 泥댄겕

$file_count   = 0;

$upload_count = count($_FILES['bf_file']['name']);

 

for ($i=0; $i<$upload_count; $i++) {

    if($_FILES['bf_file']['name'][$i] && is_uploaded_file($_FILES['bf_file']['tmp_name'][$i]))

        $file_count++;

}

 

if($w == 'u') {

    $file = get_file($bo_table, $wr_id);

    if($file_count && (int)$file['count'] > $board['bo_upload_count'])

        alert('湲곗〈 ?뚯씪????젣?섏떊 ??泥⑤??뚯씪??'.number_format($board['bo_upload_count']).'媛??댄븯濡??낅줈???댁<??떆??');

} else {

    if($file_count > $board['bo_upload_count'])

        alert('泥⑤??뚯씪??'.number_format($board['bo_upload_count']).'媛??댄븯濡??낅줈???댁<??떆??');

}

 

// ?붾젆?좊━媛 ?녿떎硫??앹꽦?⑸땲?? (?쇰??섎룄 蹂寃쏀븯援ъ슂.)

@mkdir(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);

@chmod(G5_DATA_PATH.'/file/'.$bo_table, G5_DIR_PERMISSION);

 

$chars_array = array_merge(range(0,9), range('a','z'), range('A','Z'));

 

// 媛蹂 ?뚯씪 ?낅줈??

$file_upload_msg = '';

$upload = array();

for ($i=0; $i<count($_FILES['bf_file']['name']); $i++) {

    $upload[$i]['file']     = '';

    $upload[$i]['source']   = '';

    $upload[$i]['filesize'] = 0;

    $upload[$i]['image']    = array();

    $upload[$i]['image'][0] = '';

    $upload[$i]['image'][1] = '';

    $upload[$i]['image'][2] = '';

 

    // ??젣??泥댄겕媛 ?섏뼱?덈떎硫??뚯씪????젣?⑸땲??

    if (isset($_POST['bf_file_del'][$i]) && $_POST['bf_file_del'][$i]) {

        $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_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']);

        // ?몃꽕?쇱궘??

        if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) {

            delete_board_thumbnail($bo_table, $row['bf_file']);

        }

    }

    else

        $upload[$i]['del_check'] = false;

 

    $tmp_file  = $_FILES['bf_file']['tmp_name'][$i];

    $filesize  = $_FILES['bf_file']['size'][$i];

    $filename  = $_FILES['bf_file']['name'][$i];

    $filename  = get_safe_filename($filename);

 

    // ?쒕쾭???ㅼ젙??媛믩낫???고뙆?쇱쓣 ?낅줈???쒕떎硫?

    if ($filename) {

        if ($_FILES['bf_file']['error'][$i] == 1) {

            $file_upload_msg .= '\"'.$filename.'\" ?뚯씪???⑸웾???쒕쾭???ㅼ젙('.$upload_max_filesize.')??媛믩낫???щ?濡??낅줈???????놁뒿?덈떎.\\n';

            continue;

        }

        else if ($_FILES['bf_file']['error'][$i] != 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)

                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_DATA_PATH.'/file/'.$bo_table.'/'.$row['bf_file']);

            // ?대?吏?뚯씪?대㈃ ?몃꽕?쇱궘??

            if(preg_match("/\.({$config['cf_image_extension']})$/i", $row['bf_file'])) {

                delete_board_thumbnail($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);

 

        shuffle($chars_array);

        $shuffle = implode('', $chars_array);

 

        // 泥⑤??뚯씪 泥⑤???泥⑤??뚯씪紐낆뿉 怨듬갚???ы븿?섏뼱 ?덉쑝硫??쇰? PC?먯꽌 蹂댁씠吏 ?딄굅???ㅼ슫濡쒕뱶 ?섏? ?딅뒗 ?꾩긽???덉뒿?덈떎. (湲몄긽?ъ쓽 ??090925)

        $upload[$i]['file'] = abs(ip2long($_SERVER['REMOTE_ADDR'])).'_'.substr($shuffle,0,8).'_'.replace_filename($filename);

 

        $dest_file = G5_DATA_PATH.'/file/'.$bo_table.'/'.$upload[$i]['file'];

 

        // ?낅줈?쒓? ?덈맂?ㅻ㈃ ?먮윭硫붿꽭吏 異쒕젰?섍퀬 二쎌뼱踰꾨┰?덈떎.

        $error_code = move_uploaded_file($tmp_file, $dest_file) or die($_FILES['bf_file']['error'][$i]);

 

        // ?щ씪媛??뚯씪???쇰??섏쓣 蹂寃쏀빀?덈떎.

        chmod($dest_file, G5_FILE_PERMISSION);

    }

}

 

// ?섏쨷???뚯씠釉붿뿉 ??ν븯???댁쑀??$wr_id 媛믪쓣 ??ν빐???섍린 ?뚮Ц?낅땲??

for ($i=0; $i<count($upload); $i++)

{

    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]['del_check'] || $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);

    }

}

 

// ?낅줈?쒕맂 ?뚯씪 ?댁슜?먯꽌 媛????踰덊샇瑜??살뼱 嫄곌씀濡??뺤씤??媛硫댁꽌

// ?뚯씪 ?뺣낫媛 ?녿떎硫??뚯씠釉붿쓽 ?댁슜????젣?⑸땲??

$row = sql_fetch(" select max(bf_no) as max_bf_no from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");

for ($i=(int)$row['max_bf_no']; $i>=0; $i--)

{

    $row2 = sql_fetch(" select bf_file from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");

 

    // ?뺣낫媛 ?덈떎硫?鍮좎쭛?덈떎.

    if ($row2['bf_file']) break;

 

    // 洹몃젃吏 ?딅떎硫??뺣낫瑜???젣?⑸땲??

    sql_query(" delete from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' and bf_no = '{$i}' ");

}

 

// ?뚯씪??媛쒖닔瑜?寃뚯떆臾쇱뿉 ?낅뜲?댄듃 ?쒕떎.

$row = sql_fetch(" select count(*) as cnt from {$g5['board_file_table']} where bo_table = '{$bo_table}' and wr_id = '{$wr_id}' ");

sql_query(" update {$write_table} set wr_file = '{$row['cnt']}' where wr_id = '{$wr_id}' ");

 

// ?먮룞??λ맂 ?덉퐫?쒕? ??젣?쒕떎.

sql_query(" delete from {$g5['autosave_table']} where as_uid = '{$uid}' ");

//------------------------------------------------------------------------------

 

// 鍮꾨?湲?대씪硫??몄뀡??鍮꾨?湲???꾩씠?붾? ??ν븳?? ?먯떊??湲? ?ㅼ떆 鍮꾨?踰덊샇瑜?臾살? ?딄린 ?꾪븿

if ($secret)

    set_session("ss_secret_{$bo_table}_{$wr_num}", TRUE);

 

// 硫붿씪諛쒖넚 ?ъ슜 (?섏젙湲? 諛쒖넚?섏? ?딆쓬)

if (!($w == 'u' || $w == 'cu') && $config['cf_email_use'] && $board['bo_use_email']) {

 

    // 愿由ъ옄???뺣낫瑜??산퀬

    $super_admin = get_admin('super');

    $group_admin = get_admin('group');

    $board_admin = get_admin('board');

 

    $wr_subject = get_text(stripslashes($wr_subject));

 

    $tmp_html = 0;

    if (strstr($html, 'html1'))

        $tmp_html = 1;

    else if (strstr($html, 'html2'))

        $tmp_html = 2;

 

    $wr_content = conv_content(conv_unescape_nl(stripslashes($wr_content)), $tmp_html);

 

    $warr = array( ''=>'?낅젰', 'u'=>'?섏젙', 'r'=>'?듬?', 'c'=>'肄붾찘??, 'cu'=>'肄붾찘???섏젙' );

    $str = $warr[$w];

 

    $subject = '['.$config['cf_title'].'] '.$board['bo_subject'].' 寃뚯떆?먯뿉 '.$str.'湲???щ씪?붿뒿?덈떎.';

 

    $link_url = G5_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&'.$qstr;

 

    include_once(G5_LIB_PATH.'/mailer.lib.php');

 

    ob_start();

    include_once ('./write_update_mail.php');

    $content = ob_get_contents();

    ob_end_clean();

 

    $array_email = array();

    // 寃뚯떆?먭?由ъ옄?먭쾶 蹂대궡??硫붿씪

    if ($config['cf_email_wr_board_admin']) $array_email[] = $board_admin['mb_email'];

    // 寃뚯떆?먭렇猷밴?由ъ옄?먭쾶 蹂대궡??硫붿씪

    if ($config['cf_email_wr_group_admin']) $array_email[] = $group_admin['mb_email'];

    // 理쒓퀬愿由ъ옄?먭쾶 蹂대궡??硫붿씪

    if ($config['cf_email_wr_super_admin']) $array_email[] = $super_admin['mb_email'];

 

    // ?먭?寃뚯떆?먯뿉寃?蹂대궡??硫붿씪

    if ($config['cf_email_wr_write']) {

        if($w == '')

            $wr['wr_email'] = $wr_email;

 

        $array_email[] = $wr['wr_email'];

    }

 

    // ?듭뀡??硫붿씪諛쏄린媛 泥댄겕?섏뼱 ?덇퀬, 寃뚯떆?먯쓽 硫붿씪???덈떎硫?

    if (strstr($wr['wr_option'], 'mail') && $wr['wr_email'])

        $array_email[] = $wr['wr_email'];

 

    // 以묐났??硫붿씪 二쇱냼???쒓굅

    $unique_email = array_unique($array_email);

    $unique_email = array_values($unique_email);

    for ($i=0; $i<count($unique_email); $i++) {

        mailer($wr_name, $wr_email, $unique_email[$i], $subject, $content, 1);

    }

}

 

// ?ъ슜??肄붾뱶 ?ㅽ뻾

@include_once($board_skin_path.'/write_update.skin.php');

@include_once($board_skin_path.'/write_update.tail.skin.php');

 

delete_cache_latest($bo_table);

 

if ($file_upload_msg)

    alert($file_upload_msg, G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.'&page='.$page.$qstr);

else

    goto_url(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table.'&wr_id='.$wr_id.$qstr);

?>

 

이 질문에 댓글 쓰기 :

답변 3

영역을 크게 1/4 또는 1/10 등분 해서 삭제 해가면서 실행해보세요 

 

우선 윗부분만 남기고 실행하면 페이지가 뜰겁니다.

 

그렇게 점점 내려가다보면 에러 및 오탈자 부분을 찾으실 수 있을겁니다.

 

댓글 에러 해결 방법

http://sir.kr/g5_tip/4524 

$g5['title'] = '寃뚯떆湲 ???;  

 

이부분 한글 깨져서 문제 일가능성 

 

$g5['title'] = '寃뚯떆湲 ???';  

 

이게 맞겠네요 

일단 한글이 깨진 부분을 보시면 되지 않을까 싶네요 

답변을 작성하시기 전에 로그인 해주세요.
전체 1

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT