리스트페이지에서 코멘트작성 채택완료
리스트페이지에서 코멘트작성을 하려고하는데요.
현재 리스트페이지에서 댓글버튼을 누르면 코멘트작성하는 폼과 해당글에 달린 댓글을 출력해서
보여주고 있습니다.
댓글작성폼과 폼안에있는
input type hidden 값들도 정상적으로 불러옵니다.
<input type=hidden name=w id=w value='c'>
<input type=hidden name=bo_table value='test'>
<input type=hidden name=wr_id value='102'>
<input type=hidden name=comment_id id='comment_id' value=''>
문제는 댓글을 입력하고 작성을해도 업데이트가 안돼서 DB에 들어가질 않네요..
아래는 댓글입력 폼 소스입니다.
Copy
<div id=mw_basic_comment_write_form style="position:relative; overflow:hidden; width:1030px;"> <form name="fviewcomment" method="post" action="/bbs/write_comment_update.php" onsubmit="return fviewcomment_submit(this);" autocomplete="off" style="margin:0;" enctype="multipart/form-data"><input type=hidden name=w id=w value='c'><input type=hidden name=bo_table value='<?=$bo_table?>'><input type=hidden name=wr_id value='<?=$wr_id?>'><input type=hidden name=comment_id id='comment_id' value=''><input type=hidden name=sca value='<?=$sca?>' ><input type=hidden name=sfl value='<?=$sfl?>' ><input type=hidden name=stx value='<?=$stx?>'><input type=hidden name=spt value='<?=$spt?>'><input type=hidden name=page value='<?=$page?>'><input type=hidden name=cwin value='<?=$cwin?>'><? if ($is_comment_editor) { ?><input type=hidden name=html value='html1'><? } ?> <input type="hidden" name="wr_rate" id="wr_rate" value="0"> <?phpif (!$is_member) { if (!$name) $name = get_cookie("mw_cookie_name"); if (!$email) $email = get_cookie("mw_cookie_email"); if (!$homepage) $homepage = get_cookie("mw_cookie_homepage");}?> <table border="0" cellpadding="0" cellspacing="0" style="margin-left:10px;" class="comment_write"><?php if ($is_guest && !$write_error) { ?><tr> <td width="80"> 이름 </td> <td style="padding:3px 0 3px 0;"> <input type=text maxlength=20 style="width:80px;" name="wr_name" value="<?php echo $name?>" itemname="이름" required class="mw_basic_text" <?=$write_error?>> </td></tr><tr> <td> 비밀번호 </td> <td style="padding:3px 0 3px 0;"> <input type=password maxlength=20 style="width:80px;" name="wr_password" itemname="패스워드" required class=mw_basic_text <?=$write_error?>> </td></tr><?}?> <?php if ($is_guest && $captcha_html && is_g5()) { //자동등록방지 ?><tr> <td>자동등록방지</td> <td style="padding:3px 0 3px 0;"> <?php echo $captcha_html ?> </td></tr><?php } else if (is_mw_file("$g4[bbs_path]/kcaptcha_session.php") && $is_guest && !$write_error) { ?><tr> <td> 자동등록방지 </td> <td style="padding:3px 0 3px 0;"> <script type="text/javascript"> var md5_norobot_key = ''; </script> <table border=0 cellpadding=0 cellspacing=0 style="padding:2px 0 2px 0;"> <tr> <td> <input title="우측의 글자를 입력하세요." type="input" name="wr_key" style="width:80px;" itemname="자동등록방지" required class="mw_basic_text"> 우측의 글자를 입력하세요. </td> <td width=85> <img id="kcaptcha_image" style="position:absolute; margin-top:-50px;"/> </td> </tr> </table> <? } elseif ($is_norobot) { ?> <table border=0 cellpadding=0 cellspacing=0 style="padding:2px 0 2px 0;"> <tr> <td width=85> <? // 이미지 생성이 가능한 경우 자동등록체크코드를 이미지로 만든다. if (function_exists("imagecreate") && $mw_basic[cf_norobot_image]) { echo "<img src=\"$g4[bbs_path]/norobot_image.php?{$g4['server_time']}\" border=0 align=absmiddle>"; $norobot_msg = "* 왼쪽의 자동등록방지 코드를 입력하세요."; } else { echo $norobot_str; $norobot_msg = "* 왼쪽의 글자중 <FONT COLOR='red'>빨간글자</font>만 순서대로 입력하세요."; } ?> </td> <td> <input title="왼쪽의 글자중 빨간글자만 순서대로 입력하세요." type=text size=10 name=wr_key itemname="자동등록방지" required class=mw_basic_text <?=$write_error?>> <?=$norobot_msg?> </td> </tr> </table> <?}?> </td></tr> <tr> <td colspan="2" style="line-height:30px;"> <? if (!$is_comment_editor) { ?> <? if ($mw_basic[cf_comment_html]) echo "<input type=\"checkbox\" id=\"wr_html\" name=\"html\" value=\"html2\"> <label for='wr_html'>html</label>"; ?> <? } ?> <? if (!$write_error && $mw_basic['cf_comment_secret_no'] <= $member['mb_level']) { ?> <input type=checkbox id="wr_secret" name="wr_secret" value="secret" <? if ($mw_basic[cf_comment_secret]) echo "checked" ?>> <label for="wr_secret">비밀글 </label> <? } else { ?> <span id="secret_reply" style="display:none"> <input type=checkbox id="wr_secret" name="wr_secret" checked disabled> <label for="wr_secret">비밀글 </label> </span> <? } ?> <? if ($mw_basic[cf_anonymous]) {?> <input type="checkbox" name="wr_anonymous" id="wr_anonymous" value="1"> <label for="wr_anonymous">익명</label> <? } ?> <?php if (!$is_comment_editor && ($comment_min || $comment_max)) { echo "<input type='checkbox' disabled>"; if ($comment_min > 0) { echo "$comment_min 글자 이상 "; } if ($comment_max > 0) { echo "$comment_max 글자 까지 "; } echo " 작성하실수 있습니다, "; echo "현재 <span id=char_count>0</span> 글자 작성하셨습니다. "; } ?> </td></tr></table> <table width=98% cellpadding=0 cellspacing=0 border=0><tr> <td> <?//php if (!is_g5() && (!$is_comment_editor || $mw_basic[cf_editor] != "cheditor")) { ?> <?php if ((!$is_comment_editor || $mw_basic[cf_editor] != "cheditor")) { ?> <textarea id="wr_content2" name="wr_content2" rows="6" itemname="내용" required <?php if (!$write_error) { if ($is_comment_editor && $mw_basic[cf_editor] == "geditor") echo "geditor gtag=off "; //mode=off"; } else echo $write_error; if (!$is_comment_editor && ($comment_min || $comment_max)) { echo " onkeyup=\"check_byte('wr_content2', 'char_count');\" "; } ?> class=mw_basic_textarea style="width:100%; word-break:break-all;"><?=$mw_basic[cf_comment_default]?></textarea> <?php if (!$is_comment_editor && ($comment_min || $comment_max)) { ?> <script> check_byte('wr_content2', 'char_count'); </script><?}?> <?php } ?> <?php if (is_g5()) ;//echo $editor_html; else if ($is_comment_editor && $mw_basic[cf_editor] == "cheditor") echo "<textarea name='wr_content2' id='tx_wr_content'>{$mw_basic[cf_comment_default]}</textarea>\n"; ?> </td></tr></table> <?phpif (trim($mw_basic[cf_comment_write_notice])) { $comment_write_notice = $mw_basic[cf_comment_write_notice]; $comment_write_notice = addslashes($comment_write_notice); $comment_write_notice_html = $comment_write_notice; $comment_write_notice_html = nl2br($comment_write_notice_html); $comment_write_notice_html = preg_replace("/\n/", "", $comment_write_notice_html); $comment_write_notice_html = preg_replace("/\r/", "", $comment_write_notice_html); $comment_write_notice = preg_replace("/\n/", "\\n", $comment_write_notice); $comment_write_notice = preg_replace("/\r/", "", $comment_write_notice); if (!is_g5()) {?><script>$(document).ready(function () {<?php if ($is_comment_editor) { ?> <?php if ($mw_basic[cf_editor] == "cheditor") { ?> ed_wr_content.editArea.blur(); ed_wr_content.editArea.onfocus = function () { var ed = ed_wr_content.outputBodyHTML(); if (ed == "<?=$comment_write_notice_html?>") { ed_wr_content.doc.body.innerHTML = ''; } } <?php } else if ($mw_basic[cf_editor] == 'geditor') { ?> ged = document.getElementById("geditor_wr_content_frame").contentWindow.document.body; ged.onfocus = function () { var ed = document.getElementById('wr_content2').value; if (ed == "<?$comment_write_notice_html?>") { ged.innerHTML = ''; } } <?php } ?><?php } else { ?> $("#wr_content2").focus(function () { if ($("#wr_content2").val() == "<?=$comment_write_notice?>") { $("#wr_content2").val(''); } });<?php } ?>}); </script><?php } } ?> <div style="height:40px; clear:both;"> <div class="comment_submit_button"> <div><button type="submit" class="fa-button primary center" accesskey="s" id="btn_comment_submit"><i class="fa fa-comment"></i> 입력</button></div> <?php if ($good_href || $nogood_href) { // 추천, 비추천?> <div><a href="#;" class="fa-button" onclick="mw_good_act('good')"><i class="fa fa-thumbs-o-up"></i> 추천</a></div> <div><a href="#;" class="fa-button" onclick="good_submit(fviewcomment, 'good')"><i class="fa fa-thumbs-o-up"></i> + <i class="fa fa-comment-o"></i></a></div> <?php } //good_href ?> </div> <div class="comment_function"> <?php if ($mw_basic[cf_comment_emoticon] && !$is_comment_editor && !$write_error) {?> <button type="button" class="fa-button" name="btn_emoticon" style="*margin-right:10px;"><i class="fa fa-smile-o"></i> <span class="media-comment-button">이모티콘</span></button> <script> board_skin_path = '<?php echo $board_skin_path?>'; bo_table = '<?php echo $bo_table?>'; </script> <script src="<?php echo $board_skin_path?>/mw.js/mw.emoticon.js"></script> <?php } //comment_emoticon ?> <?php if ($mw_basic['cf_comment_specialchars']) {?> <button type="button" class="fa-button" name="btn_special"><i class="fa fa-magic"></i> <span class="media-comment-button">특수문자</span></button> <script> board_skin_path = '<?php echo $board_skin_path?>'; </script> <script src="<?php echo $board_skin_path?>/mw.js/mw.specialchars.js"></script> <?php }//comment_specialchars ?> <?php if ($mw_basic[cf_comment_file] && $mw_basic[cf_comment_file] <= $member['mb_level'] && !$write_error) { ?> <button type="button" class="fa-button" onclick="$('#comment_file_layer').toggle('slow');"><i class="fa fa-save"></i> <span class="media-comment-button">첨부파일</span></button> <?php } // comment_file ?> </div></div> <? if ($mw_basic[cf_comment_file] && $mw_basic[cf_comment_file] <= $member['mb_level']) { ?><div id="comment_file_layer" style="padding:5px 0 5px 5px; display:none;"> <input type="file" name="bf_file" size="50" title='파일 용량 <?=$upload_max_filesize?> 이하만 업로드 가능'> <input type="checkbox" name="bf_file_del" value="1"> 첨부파일 삭제</div><? } ?> </form> </div>
아래소스는 /bbs/write_comment_update.php 일부분입니다.
Copy
<?phpdefine('G5_CAPTCHA', true);include_once('./_common.php');include_once(G5_CAPTCHA_PATH.'/captcha.lib.php'); // 090710if (substr_count($wr_content, "&#") > 50) { alert('내용에 올바르지 않은 코드가 다수 포함되어 있습니다.'); exit;}if(!empty($_POST[wr_content2])) $wr_content=$_POST[wr_content2]; @include_once($board_skin_path.'/write_comment_update.head.skin.php');
답변 1개
답변에 대한 댓글 1개
8년 전
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
현재 링크는 리스트페이지인데 보이는화면은 해당글 뷰페이지입니다.