게시판 게시글 수정시 중복

게시판 게시글 수정시 중복

QA

게시판 게시글 수정시 중복

본문

php는 처음해봐서 많이 버벅거려요 ㅠㅠ 

 

<?

    // 수정 링크

    if ($is_admin) {

        $update_href = "./request_wrtie.php?w=u&bo_table=$bo_table&request_type=bunyang&wr_id=$wr_id&page=$page" . $qstr;

    }

    ?>  

    <div class="page_btn">

        <div style="float:left;">

        <? if ($update_href) { echo "<a href=\"$update_href\" class='gototop'> 수정</a> "; } ?>

        </div>

        <div>

            <a href="<?=$list_href?>" class="golist">목록으로</a>

        </div>

    </div>

 

로 view.skin.manager.php 에 입력했습니다

게시판에서 게시글을 수정하면 

3024402596_1658994477.75.png

수정반영이 안되고 새로운 게시물로 업로드됩니다

 

 

<?

if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가

 

$sql = "select wr_16 from $write_table where wr_id='$wr_id'";

$dbresult = mysql_query($sql);

$ary = mysql_fetch_array($dbresult);

$wr_16_old = $ary['wr_16'];

 

if($wr_16 > 0 && $wr_16 != $wr_16_old)

{

    $sql = "update $write_table set update_datetime=now() where wr_id = '$wr_id' ";

    $dbresult = mysql_query($sql);

 

    $sql = "select count(wr_id) cnt from $write_table where wr_16='$wr_16'";

    $dbresult = mysql_query($sql);

    $ary = mysql_fetch_array($dbresult);

   

    if($ary[cnt] > 50)

    {

        $sql1 = "select wr_id from $write_table where wr_16='$wr_16' order by update_datetime desc limit 50,100";

        $dbresult1 = mysql_query($sql1);

        while($ary1 = mysql_fetch_array($dbresult1))

        {

            $sql2 = "update $write_table set wr_16='0' where wr_id='$ary1[wr_id]'";

           

            //$dbresult2 = mysql_query($sql2);

 

        }

    }

}

 

$wr_10 = "$wr_10_1|$wr_10_2|$wr_10_3|$wr_10_4|$wr_10_5|$wr_10_6|$wr_10_7|$wr_10_8|$wr_10_9|$wr_10_10|$wr_10_11|$wr_10_12|$wr_10_13|$wr_10_14|$wr_10_15";

$sql10 = "update $write_table set wr_10 = '$wr_10' where wr_id = '$wr_id' ";

sql_query($sql10);

 

$sql11 = "update $write_table

set

wr_11 = '$wr_11',

wr_47 = '$wr_47',

wr_12 = '$wr_12',

wr_13 = '$wr_13',

wr_14 = '$wr_14',

wr_15 = '$wr_15',

wr_16 = '$wr_16',

wr_17 = '$wr_17',

wr_18 = '$wr_18',

wr_19 = '$wr_19',

wr_20 = '$wr_20',

wr_25 = '$wr_25',

wr_7_1 = '$wr_7_1',

wr_8_1 = '$wr_8_1'

where wr_id = '$wr_id' ";

sql_query($sql11);

 

if($member[mb_level] > 2)

{

    $wr_21 = "$wr_21_1|$wr_21_2|$wr_21_3|$wr_21_4";

    $sql21 = "update $write_table

    set

    wr_21 = '$wr_21'

    where wr_id = '$wr_id' ";

    sql_query($sql21);

 

    $wr_22 = "$wr_22_1|$wr_22_2|$wr_22_3|$wr_22_4|$wr_22_5|$wr_22_6|$wr_22_7|$wr_22_8|$wr_22_9|$wr_22_10";

    $sql22 = "update $write_table

    set

    wr_22 = '$wr_22'

    where wr_id = '$wr_id' ";

    sql_query($sql22);

 

    $wr_facility = " $wr_facility_1|$wr_facility_2|$wr_facility_3|$wr_facility_4|$wr_facility_5|$wr_facility_6|$wr_facility_7|$wr_facility_8|$wr_facility_9|$wr_facility_10

                    |$wr_facility_11|$wr_facility_12|$wr_facility_13|$wr_facility_14|$wr_facility_15|$wr_facility_16|$wr_facility_17|$wr_facility_18|$wr_facility_19";

    $sql_facility = "update $write_table

    set

    wr_facility = '$wr_facility'

    where wr_id = '$wr_id' ";

    sql_query($sql_facility);

 

    $wr_23 = "$wr_23_1|$wr_23_2";

    $sql23 = "update $write_table

    set

    wr_23 = '$wr_23'

    where wr_id = '$wr_id' ";

    sql_query($sql23);

 

    $sql24 = "update $write_table

    set

    wr_24 = '$wr_24'

    where wr_id = '$wr_id' ";

    sql_query($sql24);

}

 

_time_limit (0);

@ini_set ("memory_limit", "200M");

 

//##add060613 이미지합성함수

function waterMark($fileInHD, $wmFile, $transparency = 60, $jpegQuality = 90, $margin = 5) {

 $wmImg  = imageCreateFromGIF($wmFile);

 $jpegImg = imageCreateFromJPEG($fileInHD);

$wmX=imageSX($jpegImg) - imageSX($wmImg);

$wmY=imageSY($jpegImg) - imageSY($wmImg);

 imageCopyMerge($jpegImg, $wmImg, $wmX, $wmY, 0, 0, imageSX($wmImg), imageSY($wmImg), $transparency);

 ImageJPEG($jpegImg, $fileInHD, $jpegQuality);

}

//##add060613 이미지합성함수


 

$data_path = $g4[path]."/data/file/$bo_table";

$thumb_path = $data_path.'/thumb';

 

if ($_FILES[bf_file][name][0])

{

    $row = sql_fetch(" select * from $g4[board_file_table] where bo_table = '$bo_table' and wr_id = '$wr_id' and bf_no = '0' ");

 

    $file = $data_path .'/'. $row[bf_file];

    if (preg_match("/\.(jp[e]?g|gif|png)$/i", $file))

    {

        $size = getimagesize($file);

        if ($size[2] == 1)

            $src = imagecreatefromgif($file);

        else if ($size[2] == 2)

            $src = imagecreatefromjpeg($file);

        else if ($size[2] == 3)

            $src = imagecreatefrompng($file);

        else

            break;

 

        $rate = $board[bo_1] / $size[0];

        $height = (int)($size[1] * $rate);

 

        @unlink($thumb_path.'/'.$wr_id);

        $dst = imagecreatetruecolor($board[bo_1], $height);

        imagecopyresampled($dst, $src, 0, 0, 0, 0, $board[bo_1], $height, $size[0], $size[1]);

        imagepng($dst, $thumb_path.'/'.$wr_id, $board[bo_2]);

        chmod($thumb_path.'/'.$wr_id, 0606);

 

waterMark($file,$g4[path]."/img/watermark.gif");

 

    }

 

}

 

?>

 

write_update.skin 파일입니다

혹시 한ㄴ번 봐주실수있을까요 ㅠㅠ

이 질문에 댓글 쓰기 :

답변 1

위 write_update.skin도 중언부언 하는 것 처럼 update를  여러번 하게 되어있어서 좋은 코드는 아니고

수정반영이 안되고 새로운 게시물로 업로드됩니다

<--이런 현상은 w=u 값이 write_update.php로 넘어가지 않아서 입니다

수정페이지에서 form의 값들 w, wr_id들이 제대로 설정되는지 확인 하세요(소스보기하여)

 

 

답변을 작성하시기 전에 로그인 해주세요.
전체 161
QA 내용 검색

회원로그인

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