게시글 작성시 오류

게시글 작성시 오류

QA

게시글 작성시 오류

본문

게시글 작성시 이메일, 홈페이지가 필수값이 아닌데 

계속 오류가 나고있습니다. 

 

1888018089_1652924742.7919.jpg


<!-- 게시물 작성/수정 시작 { -->
                <form name="fwrite" id="fwrite" action="<?php echo $action_url ?>" onsubmit="return fwrite_submit(this);" method="post" enctype="multipart/form-data" autocomplete="off" style="width:<?php echo $width; ?>">
                    <input type="hidden" name="uid" value="<?php echo get_uniqid(); ?>">
                    <input type="hidden" name="w" value="<?php echo $w ?>">
                    <input type="hidden" name="bo_table" value="<?php echo $bo_table ?>">
                    <input type="hidden" name="wr_id" value="<?php echo $wr_id ?>">
                    <input type="hidden" name="sca" value="<?php echo $sca ?>">
                    <input type="hidden" name="sfl" value="<?php echo $sfl ?>">
                    <input type="hidden" name="stx" value="<?php echo $stx ?>">
                    <input type="hidden" name="spt" value="<?php echo $spt ?>">
                    <input type="hidden" name="sst" value="<?php echo $sst ?>">
                    <input type="hidden" name="sod" value="<?php echo $sod ?>">
                    <input type="hidden" name="page" value="<?php echo $page ?>">
                    <input type="hidden" name="wr_name" value="빠른 상담 신청">
                    <input type="hidden" name="wr_1"  value="">
                    <input type="hidden" name="wr_5" value="<?php echo $ad;?>">
                    
                    <?php
                    $option = '';
                    $option_hidden = '';
                    if ($is_notice || $is_html || $is_secret || $is_mail) {
                        $option = '';
                        if ($is_notice) {
                            $option .= "\n".'<input type="checkbox" id="notice" name="notice" value="1" '.$notice_checked.'>'."\n".'<label for="notice">공지</label>';
                        }
                        if ($is_html) {
                            if ($is_dhtml_editor) {
                                $option_hidden .= '<input type="hidden" value="html1" name="html">';
                            } else {
                                $option .= "\n".'<input type="checkbox" id="html" name="html" onclick="html_auto_br(this);" value="'.$html_value.'" '.$html_checked.'>'."\n".'<label for="html">HTML</label>';
                            }
                        }
                        if ($is_secret) {
                            if ($is_admin || $is_secret==1) {
                                $option .= "\n".'<input type="checkbox" id="secret" name="secret" value="secret" '.$secret_checked.'>'."\n".'<label for="secret">비밀글</label>';
                            } else {
                                $option_hidden .= '<input type="hidden" name="secret" value="secret">';
                            }
                        }
                        if ($is_mail) {
                            $option .= "\n".'<input type="checkbox" id="mail" name="mail" value="mail" '.$recv_email_checked.'>'."\n".'<label for="mail">답변메일받기</label>';
                        }
                    }
                    echo $option_hidden;
                    ?>
                    <table class="tb-default tb-write">
                        <colgroup>
                            <col style="width:25%;">
                            <col style="width:75%;">
                        </colgroup>
                        <tbody>
                            <?php if ($is_category) { ?>
                            <tr>
                                <th>분류</th>
                                <td>
                                    <select name="ca_name" id="ca_name" class="form-control field txt" required>
                                        <option value="">분류 선택</option>
                                        <?php echo $category_option ?>
                                    </select>
                                </td>
                            </tr>
                            <?php } ?>
                            <tr>
                                <th>이름</th>
                                <td>
                                    <input type="text" name="wr_subject" id="wr_name" class="form-control field txt required" value="<?php echo $member['mb_name'] ?>" placeholder="성함" required>
                                </td>
                            </tr>
                            <tr>
                                <th>휴대폰</th>
                                <td>
                                    <select name="wr_7" itemname="휴대폰" required class="form-control select small">
                                        <option value="010">010</option>
                                        <option value="011">011</option>
                                        <option value="016">016</option>
                                        <option value="017">017</option>
                                        <option value="018">018</option>
                                        <option value="019">019</option>
                                    </select>
                                    <input name="wr_8" type="text" required class='ed' style="width:50px;border:1px solid #ddd; padding: 5px;" maxlength="4" itemname="휴대폰"/>
                                    <input name="wr_9" type="text" required class='ed' style="width:50px;border:1px solid #ddd; padding: 5px;" maxlength="4" itemname="휴대폰"/>
                                </td>
                            </tr>
                            <tr>
                                <th>메모</th>
                                <td>
                                    <?php if($write_min || $write_max) { ?>
                                    <!-- 최소/최대 글자 수 사용 시 -->
                                    <p id="char_count_desc">이 게시판은 최소 <strong><?php echo $write_min; ?></strong>글자 이상, 최대 <strong><?php echo $write_max; ?></strong>글자 이하까지 글을 쓰실 수 있습니다.</p>
                                    <?php } ?>
                                    <?php echo $editor_html; // 에디터 사용시는 에디터로, 아니면 textarea 로 노출 ?>
                                    <?php if($write_min || $write_max) { ?>
                                    <!-- 최소/최대 글자 수 사용 시 -->
                                    <div id="char_count_wrap"><span id="char_count"></span>글자</div>
                                    <?php } ?>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" style="text-align:center; height:80px;">
                                    <strong>*소중한 고객님의 정보는 상담 및 가입을 위해서만 사용됩니다.</strong><br>
                                    <input name="wr_6" type="checkbox" value="<?=$write[wr_6]?>" required >
            <!--                        <span class="style2">개인정보 활용동의</span>-->
                                    <a href="/bbs/board.php?bo_table=notice&wr_id=1" target="_blank">개인정보처리방침 동의</a>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="button-group">
                        <a href="javascript:history.back();" class="btn-type btn-type03">취소</a>
                        <button type="submit" id="btn_submit" accesskey="s" class="btn-type btn-type06">작성완료</button>
                    </div>
                </form>

 

퍼블리셔라서 자세히 설명부탁드립니다

이 질문에 댓글 쓰기 :

답변 1

239번 라인이 $wr_email = get_email_address(trim($_POST['wr_email']));

이메일인지 검증을 하는 사용자 함수가 선언이 되어있는데 값이 없으니깐 그런것 같습니다.

 

주석 처리를 하더라도 insert 에서는 변수 값을 달라고 하고있는데 주석처리를 하면 상단에 변수가 없으니깐 오류가 날수도 있구요,

 

[방법. 1]

write.skin.php에서

<?php if($w==""){ ?>

<input type="hidden" name="wr_email" value="*** 개인정보보호를 위한 이메일주소 노출방지 ***"><!-- 이메일 형태로 아무렇게나 넣어주시면 됩니다. 답글에서는 이메일 형식이라 안보이실듯 합니다. -->

<input type="hidden" name="wr_homepage" value="www.abc.co.kr">

<?php }?>

로 이메일 형태를 만들어서 값을 넘기고

 

write_update.skin.php 에서

 

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

 

$wr_email = "";

$wr_homepage = "";

$sql = " update $write_table
            set wr_email = '$wr_email',

                 wr_homepage = '$wr_homepage'
          where wr_id = '$wr_id' ";
sql_query($sql);

?>

이런식으로 값을 없애는 방법도 있습니다.

 

 

[방법 2]

 write_update.php 를 자체적으로 수정을 해서 

 

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

 

이라인을 

if($bo_table == "해당 오류 게시판 테이블 이름") {

        $wr_email = "";
        $wr_homepage = "";

}else{

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

}

이렇게 감싸도 될것 같구요.
    

 

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

회원로그인

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