테스트 사이트 - 개발 중인 베타 버전입니다

여분필드 삭제 방법좀 알려주세요 채택완료

</p>

<p>include_once($_SERVER['DOCUMENT_ROOT'] ."/common.php");</p>

<p> </p>

<p>$board_name="cscenter"; // 게시판이름

$query="select * from g5_write_".$board_name;

$result=sql_query($query);</p>

<p>for($i=0; $row=sql_fetch_array($result); $i++) {</p>

<p>$sql="update g5_write_".$board_name." set wr_11='' where wr_id='{$row['wr_id']}'";

sql_query($sql);

}</p>

<p>echo "처리되었습니다.";</p>

<p>

 

갑자기 배열로 값이 들어가서... 그냥 필드를 삭제 후 재 생성할려고 하는데

생성하는 소스는 많은데 삭제하는건 없네요..

 

위 소스를 찾아서 실행해보니까.. wr_11 이라는 필드는 그대로 남아 있고 그 안에 있는 값만 사라지네요

필드를 아예 없앨려면 어떻게 해야 하나요?

 

아니면 

 

 [wr_11] => Array         (             [0] => 서울         )

이걸  [wr_11] => 서울 이렇게 해도 괜찮습니다....

소스를 막 가져다 붙였더니.. 뭐가 잔뜩 꼬이고 있네요 ㅠㅠ

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트

wr-add.php

</p>

<p><?php

include_once('./_common.php');

include_once(G5_PATH.'/head.php');</p>

<p>if ($is_admin !== 'super') {

echo '<script language="javascript">if (window.confirm("여분필드 추가/삭제는 관리자 로그인이 필요합니다.")) {

document.location = "wr-ade.php";

}</script>';

}</p>

<p>$g5[title] = "게시판 여분필드 추가";

include_once(G5_PATH.'/head.php');

$nbm = 100;

$frm_submit = '<div class="btn_confirm01 btn_confirm">

    <input type="submit" value="확인" class="btn_submit" accesskey="s">

    '.PHP_EOL;

$frm_submit .= '</div>';</p>

<p>$sql = "select bo_table, bo_subject from {$g5['board_table']} order by gr_id";

$ff = sql_fetch($sql);

$first_tb = $ff['bo_table'];</p>

<p>if($tab == "") $tab = $first_tb;</p>

<p>$db_table = $g5['write_prefix'].$tab;

$sql = "show full columns from {$db_table} where field REGEXP 'wr_[0-9]' ";

$query = sql_query($sql);

$count = mysqli_num_rows($query);

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

    $finfo[] = mysqli_fetch_assoc($query);

}</p>

<p>if ($is_admin =='super') { 

    if($wr_start && $wr_end){

        if($board_id){

            $board_qry = " where bo_table = '{$board_id}' ";

        }

        $sql = "select * from {$g5['board_table']}".$board_qry;

        $result = sql_query($sql);

        for ($i=0; $row=sql_fetch_array($result); $i++) {

            $write_table = $g5['write_prefix'] . $row['bo_table'];

            for ($k=$wr_start; $k<=$wr_end; $k++) { 

                $cols = sql_fetch(" SHOW COLUMNS FROM {$write_table} LIKE 'wr_{$k}' ");

                if(!isset($cols)) {

                    sql_query(" ALTER TABLE `{$write_table}` ADD `wr_{$k}` varchar(255) NOT NULL DEFAULT '' "); 

                }

            }

        }

        alert('여분필드를 추가했습니다.', G5_URL.'/wr-add.php?tab='.$tab);

    }

} else { 

    alert('최고관리자만 접속 가능합니다.', G5_BBS_URL.'/login.php?wr_id='.$wr_id.$qstr.'&url='.G5_URL.'/wr-add.php');

}

?></p>

<p><div class="wr_fo">

<h2 id="h_title"><span>게시판 여분필드 추가 삭제</span></h2>

<div class="wr_form_box">

    <form name="colwrite" id="colwrite" action="<?php echo $action_url ?>" method="post" enctype="multipart/form-data" autocomplete="off" style="width:100%" onSubmit="return form_submit()">

        <div class="tbl_frm01 tbl_wrap">

        <table>

        <tr>

        <?php

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

        $ii = 'wr_'.$i;

        if(!$w){

        $qq=sql_fetch(" SHOW COLUMNS FROM g5_write_$tab like '$ii' ");

        if($qq[Type]=='varchar(255)')

            $nb = explode("wr_", $ii)[1]+1;

        }

        }

        ?>

            <th scope="row"><label for="board_id">게시판 ID</label></th>

            <td>

            <input type="text" style="background:#addeee;text-align:center;margin-top:-3px" name="board_id" value='<?php echo $tab?>' id="board_id" class="frm_input" size="15" maxlength="20" placeholder="전체게시판"></input><tho scope="row"><label for="">Table</label></tho><input type="text" style="background:none;margin-left:10px;text-align:center;margin-top:-3px" name="" value="" id="" class="frm_input1" size="15" maxlength="20" disabled></input><?php echo '<lij id="resultt">'.$tab.'</lij>';?><span style="margin-left:10px"><a class="prism-btn" href="#open-modal">도움말</a></span>

            <!-- 코드 하이라이트 모달시작 -->

            <div id="open-modal" class="modal-window">

              <div>

                <a href="#modal-close" title="닫 기" class="modal-close">닫 기</a>

                <h1>여분필드 추가/삭제 방법</h1>

                

                <ol type="I">

                <li>삭제는 게시판별 1개씩 삭제 하세요.</li>

                <li>게시판ID를 지우면 전체게시판에 추가됩니다.</li>

                <li>adm/sql_write.sql "wr_" 추가된 부분 추가</li>

                    `wr_10` varchar(255) NOT NULL,


                    `wr_11` varchar(255) NOT NULL,


                    `wr_12` varchar(255) NOT NULL,



                <li>bbs/write_update.php "wr_" 추가된 부분 추가 (2곳)</li>

                     wr_10 = '$wr_10',


                     wr_11 = '$wr_11',


                     wr_12 = '$wr_12' ";


                 sql_query($sql);



                <li>bbs/move_update.php "wr_" 추가된 부분 추가</li>

                             wr_10 = '".addslashes($row2['wr_10'])."',


                             wr_11 = '".addslashes($row2['wr_11'])."',


                             wr_12 = '".addslashes($row2['wr_12'])."' ";


                        sql_query($sql);



                <li>현재 <span class="namepen"><?php echo $tab?></span>의 여분필드는 <span class="namepen"><?php echo $nb-1?></span>번 까지 사용중 입니다.</li>

                <li>table 보기/선택  

                <select id="sels" class="nfor" onchange="if(this.value) location.href=(this.value)">

                    <?php

                    $sql = " select bo_table, bo_subject from $g5[board_table] order by gr_id, bo_table ";

                    $result = sql_query($sql);

                    for ($i=0; $row=sql_fetch_array($result); $i++) {

                    ?>

                    <option value="<?php echo G5_URL?>/wr-add.php?tab=<?php echo $row['bo_table']?>"<?php echo get_selected($row['bo_table'], $tab);?>><?php echo $row['bo_subject'];?></option>

                    <?php } ?>

                </select>

                </li>

                </ol>

              </div>

            </div>

            <!-- 코드 하이라이트 모달끝 -->

            </td>

        </tr>

        <tr>

            <th scope="row"><label for="wr_start">wr_시작번호</label></th>

            <td><input type="text" style="background:#addeee;text-align:center;margin-top:-3px" name="wr_start" value="<?php echo $nb?>" id="wr_start" class="frm_input" size="15" maxlength="20"></input><tho scope="row"><label for="wr_del">wr_삭제번호</label></tho><input type="text" name="wr_del" value="" id="wr_del" class="frm_input1 l6" size="15" maxlength="20" disabled></input><?php $nc=$nb-1;echo '<lij>'.$nc.'</lij>';?><span class="sdl" id="del_last_column" del_num="<?php echo $nb-1;?>">삭 제<span></td>

        </tr>

        <tr>

            <th scope="row"><label for="wr_end">wr_끝번호</label></th>

            <td><input type="text" onchange='printName()' style="background:#addeee;text-align:center" name="wr_end" value="" id="wr_end" class="frm_input" size="15" maxlength="3"></input><tho scope="row"><label for=""></label></tho><input type="text" name="" value="" id="" class="frm_input1 l6" size="15" maxlength="20" disabled></input><?php echo '<lij id="resulta"></lij>';?><?php echo $echo; ?><input type="submit" name="add_column" value="추 가" id="btn-submit" accesskey="s" class="wr_form_btn" disabled></input></td>

        </tr>

        </table>

        </div>

    </form>

<div class="l3">게시판 여분필드 확인</div>

</div>

<div class="l2">

<h2 id="e_title"><span>

<?php

$nbd = $nbm;

$sql = " select bo_table, bo_subject from $g5[board_table] order by gr_id, bo_table ";

$result = sql_query($sql);

for ($i=0; $row=sql_fetch_array($result); $i++) {

$tls = $row['bo_table'];

        for($k = 1; $k < $nbm; $k++) {

        $ii = 'wr_'.$k;

        if(!$w){

        $qq=sql_fetch(" SHOW COLUMNS FROM g5_write_$tls like '$ii' ");

        if($qq[Type]=='varchar(255)')

            $mb = explode("wr_", $ii)[1]+1;

        }

}

$nbb = $mb-1;

if ($nbb>$nbc)$nbc=$nbb;

if ($nbb<$nbd)$nbd=$nbb;

echo '<a href='.$_SERVER[PHP_SELF].'?tab='.$tls.'>'.$tls.'<ls style="font-size:9px;color:#0f0">('.$nbb.')</ls></a>, ';

}</p>

<p>for($b = 10;$b<100;$b++){

$find = 'wr_'.$b;

$arr = file(G5_BBS_PATH.'/move_update.php');

foreach($arr as $line){

    $str = iconv("EUC-KR","UTF-8",$line);

    if(strpos($str,$find) !== false) preg_match("#wr_(.+?) #", $str, $str3);

}

}

if($nbd !== $nbc) echo '<ls style="border:1px solid #f00;padding:5px;font-size:9px;color:#f00">[여분필드 : '.$nbd.' ~ '.$nbc.']</ls>';

if(strcmp($nbc, $str3[1]) || $nbc !== intval($str3[1])) echo '<ls style="border:1px solid #f00;padding:5px;font-size:9px;color:#f00">  /bbs/move_update.php가 wr_'.$str3[1].'입니다.</ls>';

?>

<?php if($nbd !== $nbc || $nbc !== intval($str3[1])){ ?><div class="l4">여분필드가 모두 동일하도록 추가 또는 삭제가 필요합니다.</div><?php } ?>

</span></h2></div>

</div>

<?php if(is_mobile()){ ?><div class="wr_fx l4">휴대폰을 가로모드로 하세요.</div><?php } ?>

<script>

$(document).on('change', '#wr_end', function() {

    var val= $(this).val();

    if(val < <?php echo $nb?> && val !== '' || val > 999 && val !== '') {

        alert('<?php echo $nb?>~999 범위로 입력해 주십시오.');

        $(this).val('');

        var flag = true;

        flag = $(this).val().length > 1 ? false : true;

        $("#btn-submit").prop("disabled", flag);

        const namee = document.getElementById('board_id').value;

        if(namee == ''){document.getElementById("resultt").innerText = '';}

        const namea = document.getElementById('wr_end').value;

        document.getElementById("resulta").innerText = '';

    } else {

        var flag = true;

        flag = $(this).val().length > 1 ? false : true;

        $("#btn-submit").prop("disabled", flag);

        const namee = document.getElementById('board_id').value;

        if(namee == ''){document.getElementById("resultt").innerText = '전체게시판';

        }else{

        document.getElementById("resultt").innerText = namee;

        }

        const namea = document.getElementById('wr_end').value;

        document.getElementById("resulta").innerText = namea;

        alert(namee + '[wr_<?php echo $nb?>]부터 [wr_' + namea + '] 추가가 맞습니까?');

    }

});</p>

<p>$(document).on('change', '#board_id', function() {

    var val= $(this).val();

    if(val == '') {

        var flag = true;

        flag = $(this).val().length > 1 ? false : true;

        $("#btn-submit").prop("disabled", flag);

        const namee = document.getElementById('board_id').value;

        if(namee == ''){document.getElementById("resultt").innerText = '전체게시판';

        }else{

        document.getElementById("resultt").innerText = namee;

        }

    }

});</p>

<p>$(document).on("focusout", "input[name^=wr_start]", function() {

    var val= $(this).val();

    if(val < <?php echo $nb?>|val > <?php echo $nb?>) {

        alert('<?php echo $nb?>로 입력해 주십시오.');

        $(this).val('<?php echo $nb?>');

    }

});</p>

<p>$(document).on("keyup", "input[name^=board_id]", function() {

    var val= $(this).val();

    if(val.replace(/[0]/g, "").length > 0) {

        alert('도움말/여분필드 확인에서 선택하여 주십시오.');

        location.reload();

//        $(this).val('');

    }

});</p>

<p>$(document).on("keyup", "input[name^=wr_end],input[name^=wr_start]", function() {

    var val= $(this).val();

    if(val.replace(/[0-9]/g, "").length > 0) {

        alert('숫자만 입력해 주십시오.');

        $(this).val('');

    }

});</p>

<p>function form_submit(){

    var check_submit=confirm('추가 하시겠습니까?');

    return check_submit;

}</p>

<p></script>

<style>

/*modal prism*/

.prism-btn {font-weight: bold;border:1px solid #f00;border-radius: 3px;font-weight:800;color:#eee;padding:11px;line-height:40px;cursor:pointer}

.prism-btn:hover {color:#fa0;background:#66cdaa}

.modal-window {position: fixed;top:0;right:0;bottom:0;left:0;z-index: 999;opacity:0;pointer-events:none;-webkit-transition: all 0.3s;-moz-transition: all 0.3s;transition: all 0.3s;}

.modal-window:target {opacity: 1;pointer-events: auto}

.modal-window header {font-weight: bold}

.modal-close:hover {background:#000;color:#fff;font-weight: bold}

.modal-window h1 {font-size: 150%;text-align:center;margin: -15px 0 15px}

.nfor{background:#008be9;padding-left:10px;border:1px solid #d0d3db;color:#eee;outline:none}

.tabl{margin-right:5px;padding:1px;line-height:30px;border:1px solid #d0d3db}

.tablt{margin:-10px 0}

.namepen {width: fit-content;padding: 0 0.25%;position: relative;color:#000;z-index: 1}

.namepen::after {position: absolute;display: block;content: '\00a0';width: 100%;left: 0;right: 0;top: 0%;height: 100%;color:#000;background-color:#ffd472;transform: skew(-0deg);z-index: -1}

.wr_form_btn:disabled {border:1px solid #f00;opacity:.5;background:none;color:none;cursor:default}

.frm_input1{height:40px;border:1px solid rgba(0,0,0,.01);vertical-align:middle;border-radius:3px;padding:5px;-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);

box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);}

.sdl{border:1px solid #f00;display:inline-block;color:#c1e0ff;margin-left:10px;padding:10px 15px;opacity:.5}

.sdl{border:1px solid #f00}

.sdl:hover{opacity:1;display:inline-block;cursor:pointer;margin-left:10px;background:#f00;padding:10px 15px;font-weight:bold;color:#fff}

.tbl_wrap {margin:0 0px 10px}

.tbl_wrap table{background:none;border:1px solid #d0d3db}

.tbl_frm01 th{background:none;width:100px}

body{background:linear-gradient(to right, #41f, #490e60);**#41f;**#212020}

#e_title {font-size:1em;margin-top:-15px;color:#fff;font-weight:bold;background:linear-gradient(to right, #490e60, #41f);**#212020;**#41f}

#e_title span {display:block;line-height:30px;padding:10px}

.l2{display:none;cursor:pointer}

.l2 a{color:#eee}

.l3{width:100%;height:70px;text-align:center;font-size:1em;font-weight:bold;color:#fff;cursor:pointer}

.l4{width:100%;text-align:center;font-size:2em;font-weight:bold;color:#fff;padding:100px 0}

.l6{background:none;margin-left:10px;text-align:center;color:#f00;margin-top:-3px}

tr {color:#eee;background:linear-gradient(to right, #490e60, #41f);**#212020;**#41f}

<?php if(!is_mobile()){ ?>

#h_title {font-size:1.333em;margin-top:20px;color:#fff;font-weight:bold;background:linear-gradient(to right, #490e60, #41f);**#212020;**#41f;margin:0 auto;width:560px}

#h_title span {display:block;line-height:30px;padding:10px}

.wr_form_box{padding:20px 0;margin:0 auto;width:560px}

.modal-window>div {width: 460px;position: relative;cursor:move;margin: 5% auto;padding: 2rem;line-height:20px;background: #0099ff;color: #fff;background-color: #0099ff;background-image: linear-gradient(62deg, #0099ff 0%, #0066aa 100%)}

.modal-close {color: #aaa;line-height: 50px;font-size: 80%;position: absolute;right: 0;text-align: center;top: 0;width: 70px;text-decoration: none}

lij {position:absolute;margin-left:-125px;padding:15px;color:#f00}

.wr_form_btn{display:inline-block;margin-left:10px;font-weight:bold;padding:10px 15px;color:#fff;background:#f00;border:1px solid rgba(0,0,0,.01)}

.tbl_frm01 tho {display:inline-block;margin:-7px 0 -7px 10px;width:100px;padding:10px 15px;text-align:right}

<?php } else { ?>

@media screen and (min-width: 640px) {

   .wr_fo{display:block}

   .wr_fx{display:none}

}

@media screen and (max-width: 639px) {

    .wr_fo{display:none}

    .wr_fx{display:block}

}

#h_title {font-size:1.333em;margin-top:20px;color:#fff;font-weight:bold;background:linear-gradient(to right, #490e60, #41f);**#212020;**#41f;margin:0 auto;width:640px}

#h_title span {display:block;line-height:30px;padding:10px}

.wr_form_box{padding:20px 0;margin:0 auto;width:640px}

.modal-window>div {width: 230px;position: relative;cursor:move;margin: 5% auto;padding: 2rem;line-height:20px;background: #0099ff;color: #fff;background-color: #0099ff;background-image: linear-gradient(62deg, #0099ff 0%, #0066aa 100%)}

.modal-close {color: #aaa;line-height: 50px;font-size: 80%;position: absolute;right: 0;text-align: center;top: 0;width: 35px;text-decoration: none}

lij {position:absolute;margin-left:-125px;padding:10px;color:#f00}

.wr_form_btn{display:inline-block;margin-left:10px;font-weight:bold;padding:10px 15px;color:#fff;background:#f00;border:0}

.tbl_frm01 tho {display:inline-block;margin:-7px 0 -7px 10px;width:100px;padding:10px 15px;text-align:right}

<?php } ?>

</style>

<script src="<a href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>" target="_blank" rel="noopener noreferrer">https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script></a>

<script type="text/javascript">

$(document).ready(function(){

    $(".modal-window").draggable();

});</p>

<p>$("#del_last_column").click(function(){

    if(confirm('<?php echo $tab ?>의 wr_<?php echo $nb-1 ?>을 삭제 하시겠습니까? wr_<?php echo $nb-1 ?>의 자료가 삭제됩니다.')){

        var bo_table = '<?php echo $tab ?>';

        var del_num = $(this).attr("del_num");

        

        $.ajax({

            type:"POST",

            cache: false,

            url:'<?php echo G5_URL?>/wr-add-delete.php',

            data: {bo_table:bo_table, wr_id:del_num},

            dataType: "html",

            success:function(rt_value){

                alert(rt_value);

            },

            error:function(){

                alert("error!");

            },

            complete:function(){

                document.location.reload();

            }

        });

    }

});</p>

<p>$(document).ready(function () {

    $(":checked,:selected").css("border", "2px solid red");

    $(":selected").css("background", "blue");

});</p>

<p>$('.l2,.l3').click(function(){

    var state = $('.l3').css('display');

        if(state == 'none'){

            $('.l3').show();

            $('.l2').hide();

        }else{

            $('.l3').hide();

            $('.l2').show();

        }

});

</script></p>

<p> </p>

<p><?php

include_once(G5_PATH.'/tail.php');</p>

<p>

 

wr-ade.php

</p>

<p><?php

include_once('./_common.php');</p>

<p>$g5[title] = "게시판 여분필드 추가";

include_once(G5_PATH.'/head.php');

$nbm = 100;

$frm_submit = '<div class="btn_confirm01 btn_confirm">

    <input type="submit" value="확인" class="btn_submit" accesskey="s">

    '.PHP_EOL;

$frm_submit .= '</div>';</p>

<p>$sql = "select bo_table, bo_subject from {$g5['board_table']} order by gr_id";

$ff = sql_fetch($sql);

$first_tb = $ff['bo_table'];</p>

<p>if($tab == "") $tab = $first_tb;</p>

<p>$db_table = $g5['write_prefix'].$tab;

$sql = "show full columns from {$db_table} where field REGEXP 'wr_[0-9]' ";

$query = sql_query($sql);

$count = mysqli_num_rows($query);

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

    $finfo[] = mysqli_fetch_assoc($query);

}</p>

<p>if ($is_admin =='super') { 

    if($wr_start && $wr_end){

        if($board_id){

            $board_qry = " where bo_table = '{$board_id}' ";

        }

        $sql = "select * from {$g5['board_table']}".$board_qry;

        $result = sql_query($sql);

        for ($i=0; $row=sql_fetch_array($result); $i++) {

            $write_table = $g5['write_prefix'] . $row['bo_table'];

            for ($k=$wr_start; $k<=$wr_end; $k++) { 

                $cols = sql_fetch(" SHOW COLUMNS FROM {$write_table} LIKE 'wr_{$k}' ");

                if(!isset($cols)) {

                    sql_query(" ALTER TABLE `{$write_table}` ADD `wr_{$k}` varchar(255) NOT NULL DEFAULT '' "); 

                }

            }

        }

        alert('여분필드를 추가했습니다.', G5_URL.'/wr-ade.php?tab='.$tab);

    }

} else { 

    alert('최고관리자만 접속 가능합니다.', G5_BBS_URL.'/login.php?wr_id='.$wr_id.$qstr.'&url='.G5_URL.'/wr-ade.php');

}

?></p>

<p><div class="wr_fo">

<h2 id="h_title"><span>게시판 여분필드 추가 삭제</span></h2>

<div class="wr_form_box">

    <form name="colwrite" id="colwrite" action="<?php echo $action_url ?>" method="post" enctype="multipart/form-data" autocomplete="off" style="width:100%" onSubmit="return form_submit()">

        <div class="tbl_frm01 tbl_wrap">

        <table>

        <tr>

        <?php

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

        $ii = 'wr_'.$i;

        if(!$w){

        $qq=sql_fetch(" SHOW COLUMNS FROM g5_write_$tab like '$ii' ");

        if($qq[Type]=='varchar(255)')

            $nb = explode("wr_", $ii)[1]+1;

        }

        }

        ?>

            <th scope="row"><label for="board_id">게시판 ID</label></th>

            <td>

            <input type="text" style="background:#addeee;text-align:center;margin-top:-3px" name="board_id" value='<?php echo $tab?>' id="board_id" class="frm_input" size="15" maxlength="20" placeholder="전체게시판"></input><tho scope="row"><label for="">Table</label></tho><input type="text" style="background:none;margin-left:10px;text-align:center;margin-top:-3px" name="" value="" id="" class="frm_input1" size="15" maxlength="20" disabled></input><?php echo '<lij id="resultt">'.$tab.'</lij>';?><span style="margin-left:10px"><a class="prism-btn" href="#open-modal">도움말</a></span>

            <!-- 코드 하이라이트 모달시작 -->

            <div id="open-modal" class="modal-window">

              <div>

                <a href="#modal-close" title="닫 기" class="modal-close">닫 기</a>

                <h1>여분필드 추가/삭제 방법</h1>

                

                <ol type="I">

                <li>삭제는 게시판별 1개씩 삭제 하세요.</li>

                <li>게시판ID를 지우면 전체게시판에 추가됩니다.</li>

                <li>adm/sql_write.sql "wr_" 추가된 부분 추가</li>

                    `wr_10` varchar(255) NOT NULL,


                    `wr_11` varchar(255) NOT NULL,


                    `wr_12` varchar(255) NOT NULL,



                <li>bbs/write_update.php "wr_" 추가된 부분 추가 (2곳)</li>

                     wr_10 = '$wr_10',


                     wr_11 = '$wr_11',


                     wr_12 = '$wr_12' ";


                 sql_query($sql);



                <li>bbs/move_update.php "wr_" 추가된 부분 추가</li>

                             wr_10 = '".addslashes($row2['wr_10'])."',


                             wr_11 = '".addslashes($row2['wr_11'])."',


                             wr_12 = '".addslashes($row2['wr_12'])."' ";


                        sql_query($sql);



                <li>현재 <span class="namepen"><?php echo $tab?></span>의 여분필드는 <span class="namepen"><?php echo $nb-1?></span>번 까지 사용중 입니다.</li>

                <li>table 보기/선택  

                <select id="sels" class="nfor" onchange="if(this.value) location.href=(this.value)">

                    <?php

                    $sql = " select bo_table, bo_subject from $g5[board_table] order by gr_id, bo_table ";

                    $result = sql_query($sql);

                    for ($i=0; $row=sql_fetch_array($result); $i++) {

                    ?>

                    <option value="<?php echo G5_URL?>/wr-ade.php?tab=<?php echo $row['bo_table']?>"<?php echo get_selected($row['bo_table'], $tab);?>><?php echo $row['bo_subject'];?></option>

                    <?php } ?>

                </select>

                </li>

                </ol>

              </div>

            </div>

            <!-- 코드 하이라이트 모달끝 -->

            </td>

        </tr>

        <tr>

            <th scope="row"><label for="wr_start">wr_시작번호</label></th>

            <td><input type="text" style="background:#addeee;text-align:center;margin-top:-3px" name="wr_start" value="<?php echo $nb?>" id="wr_start" class="frm_input" size="15" maxlength="20"></input><tho scope="row"><label for="wr_del">wr_삭제번호</label></tho><input type="text" name="wr_del" value="" id="wr_del" class="frm_input1 l6" size="15" maxlength="20" disabled></input><?php $nc=$nb-1;echo '<lij>'.$nc.'</lij>';?><span class="sdl" id="del_last_column" del_num="<?php echo $nb-1;?>">삭 제<span></td>

        </tr>

        <tr>

            <th scope="row"><label for="wr_end">wr_끝번호</label></th>

            <td><input type="text" onchange='printName()' style="background:#addeee;text-align:center" name="wr_end" value="" id="wr_end" class="frm_input" size="15" maxlength="3"></input><tho scope="row"><label for=""></label></tho><input type="text" name="" value="" id="" class="frm_input1 l6" size="15" maxlength="20" disabled></input><?php echo '<lij id="resulta"></lij>';?><?php echo $echo; ?><input type="submit" name="add_column" value="추 가" id="btn-submit" accesskey="s" class="wr_form_btn" disabled></input></td>

        </tr>

        </table>

        </div>

    </form>

<div class="l3">게시판 여분필드 확인</div>

</div>

<div class="l2">

<h2 id="e_title"><span>

<?php

$nbd = $nbm;

$sql = " select bo_table, bo_subject from $g5[board_table] order by gr_id, bo_table ";

$result = sql_query($sql);

for ($i=0; $row=sql_fetch_array($result); $i++) {

$tls = $row['bo_table'];

        for($k = 1; $k < $nbm; $k++) {

        $ii = 'wr_'.$k;

        if(!$w){

        $qq=sql_fetch(" SHOW COLUMNS FROM g5_write_$tls like '$ii' ");

        if($qq[Type]=='varchar(255)')

            $mb = explode("wr_", $ii)[1]+1;

        }

}

$nbb = $mb-1;

if ($nbb>$nbc)$nbc=$nbb;

if ($nbb<$nbd)$nbd=$nbb;

echo '<a href='.$_SERVER[PHP_SELF].'?tab='.$tls.'>'.$tls.'<ls style="font-size:9px;color:#0f0">('.$nbb.')</ls></a>, ';

}</p>

<p>for($b = 10;$b<100;$b++){

$find = 'wr_'.$b;

$arr = file(G5_BBS_PATH.'/move_update.php');

foreach($arr as $line){

    $str = iconv("EUC-KR","UTF-8",$line);

    if(strpos($str,$find) !== false) preg_match("#wr_(.+?) #", $str, $str3);

}

}

if($nbd !== $nbc) echo '<ls style="border:1px solid #f00;padding:5px;font-size:9px;color:#f00">[여분필드 : '.$nbd.' ~ '.$nbc.']</ls>';

if(strcmp($nbc, $str3[1])) echo '<ls style="border:1px solid #f00;padding:5px;font-size:9px;color:#f00">  /bbs/move_update.php가 wr_'.$str3[1].'입니다.</ls>';

?>

<?php if($nbd !== $nbc){ ?><div class="l4">여분필드가 모두 동일하도록 추가 또는 삭제가 필요합니다.</div><?php } ?>

</span></h2></div>

</div>

<?php if(is_mobile()){ ?><div class="wr_fx l4">휴대폰을 가로모드로 하세요.</div><?php } ?>

<script>

$(document).on('change', '#wr_end', function() {

    var val= $(this).val();

    if(val < <?php echo $nb?> && val !== '' || val > 999 && val !== '') {

        alert('<?php echo $nb?>~999 범위로 입력해 주십시오.');

        $(this).val('');

        var flag = true;

        flag = $(this).val().length > 1 ? false : true;

        $("#btn-submit").prop("disabled", flag);

        const namee = document.getElementById('board_id').value;

        if(namee == ''){document.getElementById("resultt").innerText = '';}

        const namea = document.getElementById('wr_end').value;

        document.getElementById("resulta").innerText = '';

    } else {

        var flag = true;

        flag = $(this).val().length > 1 ? false : true;

        $("#btn-submit").prop("disabled", flag);

        const namee = document.getElementById('board_id').value;

        if(namee == ''){document.getElementById("resultt").innerText = '전체게시판';

        }else{

        document.getElementById("resultt").innerText = namee;

        }

        const namea = document.getElementById('wr_end').value;

        document.getElementById("resulta").innerText = namea;

        alert(namee + '[wr_<?php echo $nb?>]부터 [wr_' + namea + '] 추가가 맞습니까?');

    }

});</p>

<p>$(document).on('change', '#board_id', function() {

    var val= $(this).val();

    if(val == '') {

        var flag = true;

        flag = $(this).val().length > 1 ? false : true;

        $("#btn-submit").prop("disabled", flag);

        const namee = document.getElementById('board_id').value;

        if(namee == ''){document.getElementById("resultt").innerText = '전체게시판';

        }else{

        document.getElementById("resultt").innerText = namee;

        }

    }

});</p>

<p>$(document).on("focusout", "input[name^=wr_start]", function() {

    var val= $(this).val();

    if(val < <?php echo $nb?>|val > <?php echo $nb?>) {

        alert('<?php echo $nb?>로 입력해 주십시오.');

        $(this).val('<?php echo $nb?>');

    }

});</p>

<p>$(document).on("keyup", "input[name^=board_id]", function() {

    var val= $(this).val();

    if(val.replace(/[0]/g, "").length > 0) {

        alert('도움말/여분필드 확인에서 선택하여 주십시오.');

        location.reload();

//        $(this).val('');

    }

});</p>

<p>$(document).on("keyup", "input[name^=wr_end],input[name^=wr_start]", function() {

    var val= $(this).val();

    if(val.replace(/[0-9]/g, "").length > 0) {

        alert('숫자만 입력해 주십시오.');

        $(this).val('');

    }

});</p>

<p>function form_submit(){

    var check_submit=confirm('추가 하시겠습니까?');

    return check_submit;

}</p>

<p></script>

<style>

/*modal prism*/

.prism-btn {font-weight: bold;border:1px solid #f00;border-radius: 3px;font-weight:800;color:#eee;padding:11px;line-height:40px;cursor:pointer}

.prism-btn:hover {color:#fa0;background:#66cdaa}

.modal-window {position: fixed;top:0;right:0;bottom:0;left:0;z-index: 999;opacity:0;pointer-events:none;-webkit-transition: all 0.3s;-moz-transition: all 0.3s;transition: all 0.3s;}

.modal-window:target {opacity: 1;pointer-events: auto}

.modal-window header {font-weight: bold}

.modal-close:hover {background:#000;color:#fff;font-weight: bold}

.modal-window h1 {font-size: 150%;text-align:center;margin: -15px 0 15px}

.nfor{background:#008be9;padding-left:10px;border:1px solid #d0d3db;color:#eee;outline:none}

.tabl{margin-right:5px;padding:1px;line-height:30px;border:1px solid #d0d3db}

.tablt{margin:-10px 0}

.namepen {width: fit-content;padding: 0 0.25%;position: relative;color:#000;z-index: 1}

.namepen::after {position: absolute;display: block;content: '\00a0';width: 100%;left: 0;right: 0;top: 0%;height: 100%;color:#000;background-color:#ffd472;transform: skew(-0deg);z-index: -1}

.wr_form_btn:disabled {border:1px solid #f00;opacity:.5;background:none;color:none;cursor:default}

.frm_input1{height:40px;border:1px solid rgba(0,0,0,.01);vertical-align:middle;border-radius:3px;padding:5px;-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);

box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);}

.sdl{border:1px solid #f00;display:inline-block;color:#c1e0ff;margin-left:10px;padding:10px 15px;opacity:.5}

.sdl{border:1px solid #f00}

.sdl:hover{opacity:1;display:inline-block;cursor:pointer;margin-left:10px;background:#f00;padding:10px 15px;font-weight:bold;color:#fff}

.tbl_wrap {margin:0 0px 10px}

.tbl_wrap table{background:none;border:1px solid #d0d3db}

.tbl_frm01 th{background:none;width:100px}

body{background:linear-gradient(to right, #41f, #490e60);**#41f;**#212020}

#e_title {font-size:1em;margin-top:-15px;color:#fff;font-weight:bold;background:linear-gradient(to right, #490e60, #41f);**#212020;**#41f}

#e_title span {display:block;line-height:30px;padding:10px}

.l2{display:none;cursor:pointer}

.l2 a{color:#eee}

.l3{width:100%;height:70px;text-align:center;font-size:1em;font-weight:bold;color:#fff;cursor:pointer}

.l4{width:100%;text-align:center;font-size:2em;font-weight:bold;color:#fff;padding:100px 0}

.l6{background:none;margin-left:10px;text-align:center;color:#f00;margin-top:-3px}

tr {color:#eee;background:linear-gradient(to right, #490e60, #41f);**#212020;**#41f}

<?php if(!is_mobile()){ ?>

#h_title {font-size:1.333em;margin-top:20px;color:#fff;font-weight:bold;background:linear-gradient(to right, #490e60, #41f);**#212020;**#41f;margin:0 auto;width:560px}

#h_title span {display:block;line-height:30px;padding:10px}

.wr_form_box{padding:20px 0;margin:0 auto;width:560px}

.modal-window>div {width: 460px;position: relative;cursor:move;margin: 5% auto;padding: 2rem;line-height:20px;background: #0099ff;color: #fff;background-color: #0099ff;background-image: linear-gradient(62deg, #0099ff 0%, #0066aa 100%)}

.modal-close {color: #aaa;line-height: 50px;font-size: 80%;position: absolute;right: 0;text-align: center;top: 0;width: 70px;text-decoration: none}

lij {position:absolute;margin-left:-125px;padding:15px;color:#f00}

.wr_form_btn{display:inline-block;margin-left:10px;font-weight:bold;padding:10px 15px;color:#fff;background:#f00;border:1px solid rgba(0,0,0,.01)}

.tbl_frm01 tho {display:inline-block;margin:-7px 0 -7px 10px;width:100px;padding:10px 15px;text-align:right}

<?php } else { ?>

@media screen and (min-width: 640px) {

   .wr_fo{display:block}

   .wr_fx{display:none}

}

@media screen and (max-width: 639px) {

    .wr_fo{display:none}

    .wr_fx{display:block}

}

#h_title {font-size:1.333em;margin-top:20px;color:#fff;font-weight:bold;background:linear-gradient(to right, #490e60, #41f);**#212020;**#41f;margin:0 auto;width:640px}

#h_title span {display:block;line-height:30px;padding:10px}

.wr_form_box{padding:20px 0;margin:0 auto;width:640px}

.modal-window>div {width: 230px;position: relative;cursor:move;margin: 5% auto;padding: 2rem;line-height:20px;background: #0099ff;color: #fff;background-color: #0099ff;background-image: linear-gradient(62deg, #0099ff 0%, #0066aa 100%)}

.modal-close {color: #aaa;line-height: 50px;font-size: 80%;position: absolute;right: 0;text-align: center;top: 0;width: 35px;text-decoration: none}

lij {position:absolute;margin-left:-125px;padding:10px;color:#f00}

.wr_form_btn{display:inline-block;margin-left:10px;font-weight:bold;padding:10px 15px;color:#fff;background:#f00;border:0}

.tbl_frm01 tho {display:inline-block;margin:-7px 0 -7px 10px;width:100px;padding:10px 15px;text-align:right}

<?php } ?>

</style>

<script src="<a href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>" target="_blank" rel="noopener noreferrer">https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script></a>

<script type="text/javascript">

$(document).ready(function(){

    $(".modal-window").draggable();

});</p>

<p>$("#del_last_column").click(function(){

    if(confirm('<?php echo $tab ?>의 wr_<?php echo $nb-1 ?>을 삭제 하시겠습니까? wr_<?php echo $nb-1 ?>의 자료가 삭제됩니다.')){

        var bo_table = '<?php echo $tab ?>';

        var del_num = $(this).attr("del_num");

        

        $.ajax({

            type:"POST",

            cache: false,

            url:'<?php echo G5_URL?>/wr-add-delete.php',

            data: {bo_table:bo_table, wr_id:del_num},

            dataType: "html",

            success:function(rt_value){

                alert(rt_value);

            },

            error:function(){

                alert("error!");

            },

            complete:function(){

                document.location.reload();

            }

        });

    }

});</p>

<p>$(document).ready(function () {

    $(":checked,:selected").css("border", "2px solid red");

    $(":selected").css("background", "blue");

});</p>

<p>$('.l2,.l3').click(function(){

    var state = $('.l3').css('display');

        if(state == 'none'){

            $('.l3').show();

            $('.l2').hide();

        }else{

            $('.l3').hide();

            $('.l2').show();

        }

});

</script></p>

<p><?php

include_once(G5_PATH.'/tail.php');</p>

<p>

 

wr-add-delete.php

</p>

<p><?php

include_once('./_common.php');</p>

<p>if($is_admin !== "super") {

    echo "error";

    exit; 

}</p>

<p>$bo_table = $_POST['bo_table'];

$wr_id = "wr_".$_POST['wr_id'];

$tb_name = $g5['write_prefix'].$bo_table;

$sql = "ALTER TABLE `{$tb_name}` DROP `{$wr_id}`";

$query = sql_query($sql, false);</p>

<p>if(!$query) {

    echo "쿼리에러";

} else {

    echo "삭제를 완료 하였습니다.";

}</p>

<p>

 

위 3개의 파일을 작성 루트에 복사후 

홈주소/wr-add.php를 실행하세요.

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

헉... 감사합니다...
일단 소중한 답변 감사합니다....
우선은 wr_12로 대체해서 사용중입니다....
자꾸
[wr_11] => Array
(
[0] =>
)
이게 계속 떠서... 하나하나 다 지우면서 테스트를 해봐야겠습니다.
제가 개인적으로 사용 중인 파일입니다.
여분필드 추가 및 삭제 도움말 기능이 있습니다.
한번 사용해 보세요.

댓글을 작성하려면 로그인이 필요합니다.

if($is_admin !== "super") {     echo "error";     exit;  }

$bo_table = $_POST['bo_table']; $wr_id = "wr_".$_POST['wr_id']; $tb_name = $g5['write_prefix'].$bo_table; $sql = "ALTER TABLE `{$tb_name}` DROP `{$wr_id}`"; $query = sql_query($sql, false);

if(!$query) {     echo "쿼리에러"; } else {     echo "삭제를 완료 하였습니다."; }

로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

$bo_table = $_POST['cscenter'];
$wr_id = "wr_".$_POST['wr_11'];

이렇게 입력했는데 쿼리에러가 나는군요... ㅠㅠ
$bo_table = $_POST['cscenter'];
$wr_id = "wr_".$_POST['wr_11'];
이렇게 해보세요. 안되면 알려 주세요.
$bo_table = "cscenter";
$wr_id = "wr_11";

댓글을 작성하려면 로그인이 필요합니다.

include_once($_SERVER['DOCUMENT_ROOT'] ."/common.php");
 
$board_name="cscenter"; // 게시판이름
sql_query("update g5_write_".$board_name." set wr_11='' ");
echo "처리되었습니다.";
로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

wr_11의 필드값은 사라졌는데... 필드는 그대로 남아있네요

[wr_11] => Array
(
[0] =>
)

이렇게..
그 부분은
출력하는 소스를 봐야 알 수 있습니다.

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고