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