비밀글 비밀번호 입력 관련 오류 확인 부탁드려요
본문
안녕하세요. 코딩 배우는 초보입니다
목록에서 비밀글 비밀번호 입력칸이 있는데, 비밀번호를 맞게 입력해도 새로고침만 되고 비밀글 열람이 안됩니다
이전 질문에서 목록에서 비밀번호 입력받는 submit의 전송이 올바르지 않을 수 있다는 답변이 와서 찾아보았는데요
-해당 스킨에서 게시물 삭제
-다른 게시판 스킨으로 변경했을 때 비밀번호 입력 및 열람
같은 행동이 정상적으로 되는 걸 보면, sql에 비밀번호는 정상적으로 저장되는 걸로 보입니다
얼핏 보기에는
view_comment.php의
$ss_name = 'ss_secret_comment_'.$bo_table.'_'.$list[$i]['wr_id'];
if(!get_session($ss_name))
$list[$i]['content'] = '<a href="./password.php?w=sc&bo_table='.$bo_table.'&wr_id='.$list[$i]['wr_id'].$qstr.'" class="s_cmt">댓글 내용 확인</a>';
부분과
view_comment.skin.php의
if (strstr($lists[$ii]['wr_option'], "secret") && !$is_admin && !$is_open && !$is_author) echo "* 작성자만 확인할 수 있습니다.";
그리고 list.skin.php의
<fieldset class="ui-qna-list-password">
<input type="password" name="wr_password" id="wr_password_<?=$ii?>" value="" placeholder="PASSWORD"/>
<button type="submit" class="ui-btn point">ENTER</button>
</fieldset>
요기가 연결이 안되는 것 같은데요...
어떻게 하면 연결이 될지는 잘 모르겠습니다...대충 무슨 기능인지만 알아볼 수 있는 초보라서요ㅠㅠ;
고수님들의 도움 부탁드립니다
아래는 해당 파일의 관련 부분들입니다
list.skin.php
<?php
$lists = array();
for ($i=0; $i<count($list); $i++) { $lists[$i] = $list[$i]; }
for ($ii=0; $ii < count($lists); $ii++) {
$profile = get_member($lists[$ii][mb_id]);
include "$board_skin_path/inc.list_main.php";
$is_open = false;
$is_author = false;
if(get_cookie('read_'.$lists[$ii][wr_id]) == $lists[$ii][wr_password] || $is_admin) $is_open = true;
if($member[mb_id] && ($member[mb_id] == $lists[$ii][mb_id])) $is_author = true;
$lists[$ii][content] = conv_content($lists[$ii][wr_content], 0, 'wr_content');
$lists[$ii][content] = search_font($stx, $lists[$ii][content]);
?>
<li class="theme-box box-shadow">
<div>
<p>
<? if($lists[$ii][is_notice]) { ?>
NOTICE
<? } else { ?>
<i>No.<?=$lists[$ii][num];?></i>
<? } ?>
<em>
<? //if($is_member && ($lists[$ii][mb_id] != '') && $is_admin) { ?>
<!--<a href="< ?=G5_BBS_URL?>/memo_form.php?me_recv_mb_id=< ?=$lists[$ii][mb_id]?>" class="send_memo">-->
<? //} ?>
<? if($is_member && $lists[$ii][ch_id]) { ?>
<a href="<?=G5_URL?>/member/viewer.php?ch_id=<?=$lists[$ii][ch_id]?>" target="_blank">
<? } ?>
<?=$lists[$ii][name]?>
<? if($is_member && $lists[$ii][ch_id]) echo "</a>"; ?>
<? //if($is_member && ($lists[$ii][mb_id] != '') && $is_admin) echo "</a>"; ?>
<? if($is_admin) { ?> <span style="font-size:10px;opacity:0.5">[ <?=$lists[$ii][wr_ip]?> ]</span><? } ?>
</em>
<strong>
<? if($is_author || $is_admin) { ?>
<a href="javascript:comment_tog('edit', '<?=$lists[$ii][wr_id]?>');">수정</a>
<a href="<?=$delete_href?>">삭제</a>
<? } else if (!$lists[$ii]['mb_id']) { ?>
<a href="<?=$delete_href?>">삭제</a>
<? } ?>
</strong>
<span class="date">
<? echo date('y.m.d H:i', strtotime($lists[$ii]['wr_datetime'])) ?>
</span>
</p>
<div class="qna-content">
<? if(strstr($lists[$ii][wr_option], 'secret') && !$is_open && !$is_author ) { ?>
<form name="fboardlist" method="post" action="<?=$board_skin_url?>/password.php" style="margin:0">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<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="wr_idx" value="<?=$lists[$ii][wr_id]?>">
<input type="hidden" name="sw" value="">
<fieldset class="ui-qna-list-password">
<input type="password" name="wr_password" id="wr_password_<?=$ii?>" value="" placeholder="PASSWORD"/>
<button type="submit" class="ui-btn point">ENTER</button>
</fieldset>
</form>
<? } else {
$str = $lists[$ii][content];
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);' border='0'>", $str);
?>
<div id="comment<?=$lists[$ii][wr_id]?>" class="content">
<? if(strstr($lists[$ii][wr_option], 'secret')) { ?>
<span style="color: #efb04e;">[SECRET]</span>
<? } ?> <?=$str?></div>
<? }
if($is_author || $is_admin) {
$str = str_replace('<br/>','',$str);
?>
<div id="edit<?=$lists[$ii][wr_id]?>" style="display:none;">
<!-- 코멘트 수정 -->
<form name="fviewcomment<?=$lists[$ii][wr_id]?>" method="post" action="./write_comment_update.php" autocomplete="off">
<input type="hidden" name="w" value="cu">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="wr_id" value="<?=$lists[$ii][wr_id]?>">
<input type="hidden" name="comment_id" value="<?=$lists[$ii][wr_id]?>">
<div class="ui-write-box autosize">
<textarea id="wr_content" name="wr_content" itemname="내용" required
<? if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?}?> style="word-break:break-all;"><?=$str?></textarea>
</div>
<? if ($comment_min || $comment_max) { ?><script type="text/javascript"> check_byte('wr_content', 'char_count'); </script><?}?>
<div class="txt-right">
<? if ($is_secret) {
if ($is_admin || $is_secret==1) {
?>
<input type="checkbox" id="re_secret<?=$lists[$ii][wr_id]?>" name="wr_secret" value="secret" <? if(strstr($lists[$ii][wr_option], 'secret')) echo "checked";?>> <label for="re_secret<?=$lists[$ii][wr_id]?>">SECRET</label>
<?
} else echo "<input type='hidden' name='wr_secret' value='secret'>";
} ?>
<button type="submit" id="btn_submit" class="ui-btn" accesskey="s">ENTER</button>
</div>
</form>
</div>
<? } ?>
</div>
</div>
<div id="cmt_<?=$lists[$ii][wr_id]?>">
<?php
$wr_id = $lists[$ii][wr_id];
include ("$board_skin_path/view_comment.php");
?>
</div>
</li>
view_comment.php
$list[$i]['content'] = $list[$i]['content1']= 'SECRET MESSAGE';
if (!strstr($c_row['wr_option'], 'secret') ||
$is_admin ||
($write['mb_id']==$member['mb_id'] && $member['mb_id']) ||
($c_row['mb_id']==$member['mb_id'] && $member['mb_id'])) {
$list[$i]['content1'] = $c_row['wr_content'];
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
$list[$i]['content'] = search_font($stx, $list[$i]['content']);
} else {
$ss_name = 'ss_secret_comment_'.$bo_table.'_'.$list[$i]['wr_id'];
if(!get_session($ss_name))
$list[$i]['content'] = '<a href="./password.php?w=sc&bo_table='.$bo_table.'&wr_id='.$list[$i]['wr_id'].$qstr.'" class="s_cmt">댓글 내용 확인</a>';
else {
$list[$i]['content'] = conv_content($c_row['wr_content'], 0, 'wr_content');
$list[$i]['content'] = search_font($stx, $list[$i]['content']);
}
}
$list[$i]['datetime'] = substr($c_row['wr_datetime'],2,14);
// 관리자가 아니라면 중간 IP 주소를 감춘후 보여줍니다.
$list[$i]['ip'] = $c_row['wr_ip'];
if (!$is_admin)
$list[$i]['ip'] = preg_replace("/([0-9]+).([0-9]+).([0-9]+).([0-9]+)/", G5_IP_DISPLAY, $c_row['wr_ip']);
$list[$i]['is_reply'] = false;
$list[$i]['is_edit'] = false;
$list[$i]['is_del'] = false;
if ($is_comment_write || $is_admin)
{
$token = '';
if ($member['mb_id'])
{
if ($c_row['mb_id'] == $member['mb_id'] || $is_admin)
{
set_session('ss_delete_comment_'.$c_row['wr_id'].'_token', $token = uniqid(time()));
$list[$i]['del_link'] = './delete_comment.php?bo_table='.$bo_table.'&comment_id='.$c_row['wr_id'].'&token='.$token.'&page='.$page.$qstr;
$list[$i]['is_edit'] = true;
$list[$i]['is_del'] = true;
}
}
else
{
if (!$c_row['mb_id']) {
$list[$i]['del_link'] = './password.php?w=x&bo_table='.$bo_table.'&comment_id='.$c_row['wr_id'].'&page='.$page.$qstr;
$list[$i]['is_del'] = true;
}
}
if (strlen($c_row['wr_comment_reply']) < 5)
$list[$i]['is_reply'] = true;
}
view_comment.skin.php
<div style="display:none">
<?php if ($is_comment_write) {
if (strstr($lists[$ii]['wr_option'], "secret") && !$is_admin && !$is_open && !$is_author || $is_guest) echo "";
else {
?>
<div class="ui-write-area" id="reply<?=$wr_id?>">
<!-- 코멘트 입력 테이블시작 -->
<form name="fviewcomment<?=$wr_id?>" id="fviewcomment<?=$wr_id?>" method="post" action="./write_comment_update.php" onsubmit="return fviewcomment_submit('<?=$wr_id?>');" autocomplete="off">
<input type="hidden" name="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" value="">
<input type="hidden" name="token" value="<?=$comment_token?>">
<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?>">
<input type="hidden" name="is_good" value="">
<input type="hidden" name="url" value="./board.php?bo_table=<?=$bo_table?>&page=<?=$page?>">
<textarea id="wr_content" name="wr_content" rows="4" itemname="내용" style="width:100%; word-break:break-all;" class="tx"
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?> required><?=$list[$i]['wr_content']?></textarea>
<?php if ($comment_min || $comment_max) { ?><script>check_byte('wr_content', 'char_count');</script><?php } ?>
<div class="txt-right">
<button type="submit" id="btn_submit" class="ui-btn" accesskey="s">ENTER</button>
</div>
</form>
</div>
<?php }
} ?>
<ul>
<!-- 코멘트 리스트 -->
<?php
for ($i=0; $i<count($list); $i++) {
$comment_id = $list[$i]['wr_id'];
?>
<li>
<div class="qna-comment-content">
<!-- 코멘트 출력 -->
<p class="co-info">
<?php /*if($is_member && ($list[$i][mb_id] != '') && $is_admin) { ?>
<a href="< ?=G5_BBS_URL?>/memo_form.php?me_recv_mb_id=< ?=$list[$i][mb_id]?>" class="send_memo">
<?php }*/
if($is_member && $list[$i]['ch_id']) {
?>
<a href="<?=G5_URL?>/member/viewer.php?ch_id=<?=$list[$i]['ch_id']?>" target="_blank">
<?php }
echo $list[$i]['name'];
if($is_member && $list[$i]['ch_id']) echo "</a>";
//if($is_member && ($list[$i][mb_id] != '') && $is_admin) echo "</a>";
?>
<em><?php if ($list[$i]['is_edit']) echo "<a href=\"javascript:comment_tog('edit', '{$comment_id}');\">수정</a>"; ?></em>
<em><?php if ($list[$i]['is_del']) echo "<a href=\"javascript:comment_delete('{$list[$i]['del_link']}');\">삭제</a>"; ?></em>
<span class="date"><?php echo date('y.m.d H:i', strtotime($list[$i]['datetime'])) ?></span>
</p>
<?php
if (strstr($lists[$ii]['wr_option'], "secret") && !$is_admin && !$is_open && !$is_author) echo "* 작성자만 확인할 수 있습니다.";
else {
$str = $list[$i]['content'];
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp|mms)\:\/\/([^[:space:]]+)\.(mp3|wma|wmv|asf|asx|mpg|mpeg)\".*\<\/a\>\]/i", "<script>doc_write(obj_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s.*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(swf)\".*\<\/a\>\]/i", "<script>doc_write(flash_movie('$1://$2.$3'));</script>", $str);
$str = preg_replace("/\[\<a\s*href\=\"(http|https|ftp)\:\/\/([^[:space:]]+)\.(gif|png|jpg|jpeg|bmp)\"\s*[^\>]*\>[^\s]*\<\/a\>\]/i", "<img src='$1://$2.$3' id='target_resize_image[]' onclick='image_window(this);' border='0'>", $str);
?>
<div id="comment<?=$comment_id?>" class="content"><?=$str?></div>
<?php }
if ($list[$i]['is_edit']) {
$str = str_replace('<br/>','',$str);
?>
<div id="edit<?=$comment_id?>" style="display:none;">
<!-- 코멘트 수정 -->
<form name="fviewcomment<?=$comment_id?>" method="post" action="./write_comment_update.php" autocomplete="off">
<input type="hidden" name="w" value="cu">
<input type="hidden" name="bo_table" value="<?=$bo_table?>">
<input type="hidden" name="wr_id" value="<?=$comment_id?>">
<input type="hidden" name="comment_id" value="<?=$comment_id?>">
<div class="ui-write-box">
<textarea id="wr_content" name="wr_content" itemname="내용" style="word-break:break-all;"
<?php if ($comment_min || $comment_max) { ?>onkeyup="check_byte('wr_content', 'char_count');"<?php } ?> required><?=$str?></textarea>
</div>
<?php if ($comment_min || $comment_max) { ?><script>check_byte('wr_content', 'char_count');</script><?php } ?>
<div class="txt-right">
<button type="submit" class="ui-btn" accesskey="s">ENTER</button>
</div>
</form>
</div>
<?php } ?>
</div>
</li>
<?php } ?>
</ul>
</div>
답변 1
일단 위 소스로 봐서는 답변 받기가 어려울 수 있어요.
submit 할때 그냥 새로고침 되면 섭밋되는 경로가 비어있을 수 있구요.
아니면 오류나서 리턴된거 일 수도 있구요.
중간중간 로그 뽑으면서 확인해야될것 같아요.