이미지 태그 출력 오류 문의 드립니다. (재문의)
본문
(신규 글등록 및 테스트 해보셔도 됩니다.)
메모장 형식의 게시판인데요~
글작성 공간에
<img src="http://img.naver.net/static/www/u/2013/0731/nmms_224940510.gif"><br>테스트
그냥 이렇게 간단히 단순하게 입력후 글등록을 했는데 테스트 페이지처럼 이미지 태그로만 글을 입력하면 꼭
글씨가 두 번이나 연속으로 나오고 "> 이런게 붙는 현상이 있네요;; 도와주세요 ㅠㅠ
--------- list.skin.php 소스 내용 전문 --------
<?
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
if (!defined("_GNUBOARD_")) exit; // 개별 페이지 접근 불가
// 이모티콘
function emoticon_html($str, $board_skin_path)
{
$emo_id = "$str";
$img_src = "<img src='$board_skin_path/emoticons/$str.gif' width='18' height='18' border='0'>";
$str = eregi_replace($emo_id, $img_src, $str);
function emoticon_html($str, $board_skin_path)
{
$emo_id = "$str";
$img_src = "<img src='$board_skin_path/emoticons/$str.gif' width='18' height='18' border='0'>";
$str = eregi_replace($emo_id, $img_src, $str);
return $str;
}
?>
}
?>
<style>
.bbs_form { margin:0; }
.bbs_linei { background-color:#ffffff; height:1px; }
.bbs_lineo { background-color:#cccccc; height:1px; }
.bbs_no { background-color:#ffffff; height:30px; }
.bbs_fs { color:#cccccc; font-size:11px; }
.bbs_form { margin:0; }
.bbs_linei { background-color:#ffffff; height:1px; }
.bbs_lineo { background-color:#cccccc; height:1px; }
.bbs_no { background-color:#ffffff; height:30px; }
.bbs_fs { color:#cccccc; font-size:11px; }
.bbs_ft { border-color:#cccccc; border-style:solid; border-width:1px; }
.bbs_tt { CURSOR:pointer; }
.bbs_tt { CURSOR:pointer; }
a.bbs:link, a.bbs:visited, a.bbs:active { text-decoration:none; list-style-image:none}
a.bbs:hover { text-decoration:none; color:#ccccccc; }
</style>
a.bbs:hover { text-decoration:none; color:#ccccccc; }
</style>
<script language="JavaScript">
function emo_change(no) {
if ( document.getElementById('emoticon_' + no).style.visibility == "hidden" ) {
document.getElementById('emoticon_' + no).style.visibility = "visible" ;
} else {
document.getElementById('emoticon_' + no).style.visibility = "hidden" ;
}
}
function show(no) {
document.getElementById('emoticon_' + no).style.visibility = "visible" ;
}
function hide(no) {
document.getElementById('emoticon_' + no).style.visibility = "hidden" ;
}
function emo_change(no) {
if ( document.getElementById('emoticon_' + no).style.visibility == "hidden" ) {
document.getElementById('emoticon_' + no).style.visibility = "visible" ;
} else {
document.getElementById('emoticon_' + no).style.visibility = "hidden" ;
}
}
function show(no) {
document.getElementById('emoticon_' + no).style.visibility = "visible" ;
}
function hide(no) {
document.getElementById('emoticon_' + no).style.visibility = "hidden" ;
}
function insertSmiley(emo, no, ff){
var skin_path = "<?=$board_skin_path?>";
var skin_path = "<?=$board_skin_path?>";
if(ff) {
ff.mainimage.src = skin_path + "/emoticons/" + emo + ".gif";
ff.wr_subject.value = emo;
document.getElementById('emoticon_' + no).style.visibility = "hidden" ;
}
}
ff.mainimage.src = skin_path + "/emoticons/" + emo + ".gif";
ff.wr_subject.value = emo;
document.getElementById('emoticon_' + no).style.visibility = "hidden" ;
}
}
// 글자수 제한
var char_min = parseInt(<?=$write_min?>); // 최소
var char_max = parseInt(<?=$write_max?>); // 최대
</script>
var char_min = parseInt(<?=$write_min?>); // 최소
var char_max = parseInt(<?=$write_max?>); // 최대
</script>
<?
if ($w == "") {
$is_name = false;
$is_password = false;
if ($w == "") {
$is_name = false;
$is_password = false;
if (!$member[mb_id] || ($is_admin && $w == 'u' && $member[mb_id] != $write[mb_id])) {
$is_name = true;
$is_password = true;
}
$is_name = true;
$is_password = true;
}
$password_required = "required";
$content = $board[bo_insert_content];
$content = $board[bo_insert_content];
// 글자수 제한 설정값
if ($is_admin)
{
$write_min = $write_max = 0;
}
else
{
$write_min = (int)$board[bo_write_min];
$write_max = (int)$board[bo_write_max];
}
include_once("./norobot.inc.php");
}
if ($is_admin)
{
$write_min = $write_max = 0;
}
else
{
$write_min = (int)$board[bo_write_min];
$write_max = (int)$board[bo_write_max];
}
include_once("./norobot.inc.php");
}
if (!$subject) $subject = 1;
?>
?>
<form name="ffwrite" method="post" action="javascript:fwrite_check(document.ffwrite);" enctype="multipart/form-data" autocomplete="off">
<input type=hidden name=w value="">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=wr_id value="">
<input type=hidden name=page value="<?=$page?>">
<input type=hidden name=wr_subject value="<?=$subject?>">
<? if ($is_password) { ?><input type="hidden" name="wr_password" value="<?=$norobot_str?>"><? } ?>
<? if ($is_norobot) { ?><input type="hidden" name="wr_key" value="<?=$norobot_key?>"><? } ?>
<input type=hidden name=w value="">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=wr_id value="">
<input type=hidden name=page value="<?=$page?>">
<input type=hidden name=wr_subject value="<?=$subject?>">
<? if ($is_password) { ?><input type="hidden" name="wr_password" value="<?=$norobot_str?>"><? } ?>
<? if ($is_norobot) { ?><input type="hidden" name="wr_key" value="<?=$norobot_key?>"><? } ?>
<table width="<?=$width?>" align="center" cellpadding="5" cellspacing="0" bgcolor="#ffffff"><tr><td align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="list-style-image:none">
<textarea name="wr_content" cols="80" class="bbs_ft" style="width:100%;height:50; padding:4;" onfocus="clearText(this)" itemname="내용" required="required"></textarea> </td>
<td width="10"></td>
<? if ($is_name) { ?>
<td width="80">
<input class="bbs_ft" maxLength="20" size="13" name="wr_name" itemname="이름" required style="height:23; padding:4;" value="손님" onFocus="clearText(this)"> </td>
<td width="10"></td>
<? } ?>
<td width="30">
<input type="image" id="btn_submit" src="<?=$board_skin_path?>/img/btn_write.gif" border="0" align="absmiddle"> </td>
</tr>
</table>
</td></tr></table>
</form>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="list-style-image:none">
<textarea name="wr_content" cols="80" class="bbs_ft" style="width:100%;height:50; padding:4;" onfocus="clearText(this)" itemname="내용" required="required"></textarea> </td>
<td width="10"></td>
<? if ($is_name) { ?>
<td width="80">
<input class="bbs_ft" maxLength="20" size="13" name="wr_name" itemname="이름" required style="height:23; padding:4;" value="손님" onFocus="clearText(this)"> </td>
<td width="10"></td>
<? } ?>
<td width="30">
<input type="image" id="btn_submit" src="<?=$board_skin_path?>/img/btn_write.gif" border="0" align="absmiddle"> </td>
</tr>
</table>
</td></tr></table>
</form>
<br>
<table width="<?=$width?>" align="center" cellpadding="0" cellspacing="0"><tr><td>
<!-- 게시판 리스트 시작 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan="6" class="bbs_lineo"></td></tr>
<? for ($i=0; $i<count($list); $i++) {
$list_id = $list[$i][wr_id];
?>
<a name="c_<?=$list_id?>"></a>
<!-- 게시판 리스트 시작 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td colspan="6" class="bbs_lineo"></td></tr>
<? for ($i=0; $i<count($list); $i++) {
$list_id = $list[$i][wr_id];
?>
<a name="c_<?=$list_id?>"></a>
<tr>
<td width="40" height="30" align="center">
<? if (!$list[$i][reply]) {?>
<?=$list[$i][num]?>
<?}?>
</td>
<td width="40" height="30" align="center">
<? if (!$list[$i][reply]) {?>
<?=$list[$i][num]?>
<?}?>
</td>
<td style="padding : 5px; border:hidden">
<?
echo $list[$i][reply];
echo $list[$i][icon_reply];
?>
<a href="javascript:list_box('<?=$list_id?>', 'r');" title="답변" class="bbs"><?=$list[$i][wr_content]?></a>
<? if (($member[mb_id] && ($member[mb_id] == $list[$i][mb_id])) || $is_admin) { ?>
<a href="javascript:list_box('<?=$list_id?>', 'u');"><img src="<?=$board_skin_path?>/img/btn_edit.gif" title="수정" border="0" align="absmiddle"></a>
<a href="javascript:if (confirm('삭제하시겠습니까?')) { location='./delete.php?w=d&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&page=<?=$page?>';}"><img src="<?=$board_skin_path?>/img/btn_del.gif" title="삭제" border="0" align="absmiddle"></a>
<? } ?>
<?=$list[$i][icon_new];?> </td>
<?
echo $list[$i][reply];
echo $list[$i][icon_reply];
?>
<a href="javascript:list_box('<?=$list_id?>', 'r');" title="답변" class="bbs"><?=$list[$i][wr_content]?></a>
<? if (($member[mb_id] && ($member[mb_id] == $list[$i][mb_id])) || $is_admin) { ?>
<a href="javascript:list_box('<?=$list_id?>', 'u');"><img src="<?=$board_skin_path?>/img/btn_edit.gif" title="수정" border="0" align="absmiddle"></a>
<a href="javascript:if (confirm('삭제하시겠습니까?')) { location='./delete.php?w=d&bo_table=<?=$bo_table?>&wr_id=<?=$list[$i][wr_id]?>&page=<?=$page?>';}"><img src="<?=$board_skin_path?>/img/btn_del.gif" title="삭제" border="0" align="absmiddle"></a>
<? } ?>
<?=$list[$i][icon_new];?> </td>
<td width="80"> </td>
<td width="60" align="center"><span class="bbs_fs"><?=$list[$i][datetime2]?></span></td>
</tr>
<tr>
<td colspan="6" style="word-break:break-all;" class="bbs_pp">
<img id='save_emoticon_<?=$list_id?>' style='display:none;' border="0" src="<?=$board_skin_path?>/emoticons/<?=$list[$i][subject]?>.gif">
<input id='save_content_<?=$list_id?>' class="bbs_ft" type=text style='display:none;width:100%;height:23; padding:4;' value="<?=$list[$i][wr_content]?>">
</tr>
<tr>
<td colspan="6" style="word-break:break-all;" class="bbs_pp">
<img id='save_emoticon_<?=$list_id?>' style='display:none;' border="0" src="<?=$board_skin_path?>/emoticons/<?=$list[$i][subject]?>.gif">
<input id='save_content_<?=$list_id?>' class="bbs_ft" type=text style='display:none;width:100%;height:23; padding:4;' value="<?=$list[$i][wr_content]?>">
<span id='reply_<?=$list_id?>' style='display:none; width:100%; padding:5;'></span><!-- 답변 -->
<span id='edit_<?=$list_id?>' style='display:none; width:100%; padding:5;'></span><!-- 수정 --> </td>
</tr>
<tr><td colspan="6" class="bbs_linei"></td></tr>
<? } ?>
<span id='edit_<?=$list_id?>' style='display:none; width:100%; padding:5;'></span><!-- 수정 --> </td>
</tr>
<tr><td colspan="6" class="bbs_linei"></td></tr>
<? } ?>
<? if (count($list) == 0) { ?>
<tr>
<td height="100" align="center">메모 테스트</td>
</tr>
<tr><td class="bbs_linei"></td></tr>
<? } ?>
</table>
<tr>
<td height="100" align="center">메모 테스트</td>
</tr>
<tr><td class="bbs_linei"></td></tr>
<? } ?>
</table>
<!-- 페이지 표시 시작 -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<? if ($write_pages || $prev_part_href || $next_part_href ) { ?>
<tr>
<td height="25" align="center" class="bbs_no">
<? if ($prev_part_href) { echo "<a href='$prev_part_href'><img src='$board_skin_path/img/btn_search_prev.gif' width=50 height=20 border=0 align=absmiddle title='이전검색'></a>"; } ?>
<?
// 기본으로 넘어오는 페이지를 아래와 같이 변환하여 이미지로도 출력할 수 있습니다.
//echo $write_pages;
$write_pages = str_replace("처음", "<img src='$board_skin_path/img/page_first.gif' border='0' align='absmiddle' title='처음' width='38' height='15'>", $write_pages);
$write_pages = str_replace("이전", "<img src='$board_skin_path/img/page_prev.gif' border='0' align='absmiddle' title='이전' width='17' height='15'>", $write_pages);
$write_pages = str_replace("다음", "<img src='$board_skin_path/img/page_next.gif' border='0' align='absmiddle' title='다음' width='17' height='15'>", $write_pages);
$write_pages = str_replace("맨끝", "<img src='$board_skin_path/img/page_end.gif' border='0' align='absmiddle' title='맨끝' width='38' height='15'>", $write_pages);
$write_pages = preg_replace("/<span>([0-9]*)<\/span>/", "<font style=\"font-family:돋움; font-size:9pt; color:#797979\">$1</font>", $write_pages);
$write_pages = preg_replace("/<b>([0-9]*)<\/b>/", "<font style=\"font-family:돋움; font-size:9pt; color:orange;\">$1</font>", $write_pages);
?>
<?=$write_pages?>
<? if ($next_part_href) { echo "<a href='$next_part_href'><img src='$board_skin_path/img/btn_search_next.gif' width=50 height=20 border=0 align=absmiddle title='다음검색'></a>"; } ?>
</td>
</tr>
<? } ?>
<tr><td class="bbs_lineo"></td></tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="" height="40">
<? if ($admin_href) { ?><a href='<?=$admin_href?>'><img src="<?=$board_skin_path?>/img/btn_admin.gif" border="0" width="55" height="20" align="absmiddle" title="관리자"></a><? } ?>
</td>
</tr>
</table>
</td></tr></table>
<tr>
<td width="" height="40">
<? if ($admin_href) { ?><a href='<?=$admin_href?>'><img src="<?=$board_skin_path?>/img/btn_admin.gif" border="0" width="55" height="20" align="absmiddle" title="관리자"></a><? } ?>
</td>
</tr>
</table>
</td></tr></table>
<span id=list_write style='display:none; width:100%; padding:10;'>
<form name="fwrite" method="post" action="javascript:fwrite_check(document.fwrite);" enctype="multipart/form-data" autocomplete="off">
<input type=hidden name=w value="" id="list_w">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=wr_id value="<?=$list[$i][wr_id]?>" id="list_id">
<input type=hidden name=page value="<?=$page?>">
<input type=hidden name=wr_subject value="<?=$subject?>">
<? if ($is_password) { ?><input type="hidden" name="wr_password" value="<?=$norobot_str?>"><? } ?>
<? if ($is_norobot) { ?><input type="hidden" name="wr_key" value="<?=$norobot_key?>"><? } ?>
<form name="fwrite" method="post" action="javascript:fwrite_check(document.fwrite);" enctype="multipart/form-data" autocomplete="off">
<input type=hidden name=w value="" id="list_w">
<input type=hidden name=bo_table value="<?=$bo_table?>">
<input type=hidden name=wr_id value="<?=$list[$i][wr_id]?>" id="list_id">
<input type=hidden name=page value="<?=$page?>">
<input type=hidden name=wr_subject value="<?=$subject?>">
<? if ($is_password) { ?><input type="hidden" name="wr_password" value="<?=$norobot_str?>"><? } ?>
<? if ($is_norobot) { ?><input type="hidden" name="wr_key" value="<?=$norobot_key?>"><? } ?>
<table width="<?=$width?>" align="center" cellpadding="5" cellspacing="0" bgcolor="#ffffff"><tr><td align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" class="bbs_tt" style="padding-top:3px;">
<img id="list_image" name="mainimage" border="0" src="<?=$board_skin_path?>/emoticons/<?=$subject?>.gif"><br></td>
<td width="5"></td>
<td>
<textarea name="wr_content" class="bbs_ft" id="list_content" style="width:100%;height:50; padding:4;" onfocus="clearText(this)" itemname="내용" required="required"></textarea>
</td>
<td width="10"></td>
<? if ($is_name) { ?>
<td width="80">
<input class="bbs_ft" maxLength="20" size="13" name="wr_name" itemname="이름" required style="height:23; padding:4;" value="손님" onFocus="clearText(this)">
</td>
<td width="10"></td>
<? } ?>
<td width="30">
<input type="image" id="btn_submit" src="<?=$board_skin_path?>/img/btn_write.gif" border="0" align="absmiddle">
</td>
</tr>
</table>
</td></tr></table>
</form>
</span>
<script language="Javascript">
function clearText(thefield){
if (thefield.defaultValue==thefield.value) thefield.value = "";
}
function clearText(thefield){
if (thefield.defaultValue==thefield.value) thefield.value = "";
}
function fwrite_check(f)
{
var s = "";
if (f.wr_content.value == "내용을 써야디ㅠㅠ"){
alert("내용을 써야디ㅠㅠ")
return;
}
{
var s = "";
if (f.wr_content.value == "내용을 써야디ㅠㅠ"){
alert("내용을 써야디ㅠㅠ")
return;
}
if (s = word_filter_check(f.wr_content.value)) {
alert("내용에 금지단어('"+s+"')가 포함되어있습니다");
return;
}
alert("내용에 금지단어('"+s+"')가 포함되어있습니다");
return;
}
f.action = "./write_update.php";
f.submit();
}
f.submit();
}
var old_id, new_id;
var save_html = document.getElementById('list_write').innerHTML;
var save_html = document.getElementById('list_write').innerHTML;
function list_box(list_id, work)
{
// 답변, 수정
if (list_id)
{
if (work == 'r')
new_id = 'reply_' + list_id;
else
new_id = 'edit_' + list_id;
}
else
new_id = 'list_write';
{
// 답변, 수정
if (list_id)
{
if (work == 'r')
new_id = 'reply_' + list_id;
else
new_id = 'edit_' + list_id;
}
else
new_id = 'list_write';
if (old_id == new_id) {
var mode = document.getElementById(new_id).style.display;
if (mode == 'inline')
document.getElementById(new_id).style.display = 'none';
else
document.getElementById(new_id).style.display = 'inline';
}
else
{
if (old_id)
{
document.getElementById(old_id).style.display = 'none';
document.getElementById(old_id).innerHTML = '';
}
var mode = document.getElementById(new_id).style.display;
if (mode == 'inline')
document.getElementById(new_id).style.display = 'none';
else
document.getElementById(new_id).style.display = 'inline';
}
else
{
if (old_id)
{
document.getElementById(old_id).style.display = 'none';
document.getElementById(old_id).innerHTML = '';
}
document.getElementById(new_id).style.display = 'inline';
document.getElementById(new_id).innerHTML = save_html;
document.getElementById(new_id).innerHTML = save_html;
// 수정
if (work == 'u')
{
document.getElementById('list_image').src = document.getElementById('save_emoticon_' + list_id).src;
document.getElementById('list_content').value = document.getElementById('save_content_' + list_id).value;
}
if (work == 'u')
{
document.getElementById('list_image').src = document.getElementById('save_emoticon_' + list_id).src;
document.getElementById('list_content').value = document.getElementById('save_content_' + list_id).value;
}
document.getElementById('list_id').value = list_id;
document.getElementById('list_w').value = work;
old_id = new_id;
}
}
document.getElementById('list_w').value = work;
old_id = new_id;
}
}
list_box('', '');
new_id = 'list_write';
document.getElementById(new_id).style.display = 'none';
</script>
new_id = 'list_write';
document.getElementById(new_id).style.display = 'none';
</script>
<?
if ($w == "") {
if (!$member[mb_id])
echo "<script language='javascript' src='$g4[path]/js/md5.js'></script>\n";
if ($w == "") {
if (!$member[mb_id])
echo "<script language='javascript' src='$g4[path]/js/md5.js'></script>\n";
// 필터
echo "<script language='javascript'> var g4_cf_filter = '$config[cf_filter], '; </script>\n";
echo "<script language='javascript' src='$g4[path]/js/filter.js'></script>\n";
}
?>
echo "<script language='javascript'> var g4_cf_filter = '$config[cf_filter], '; </script>\n";
echo "<script language='javascript' src='$g4[path]/js/filter.js'></script>\n";
}
?>
------------------- 끝 ---------------------
답변 1
이유는 단 한가지입니다. 내용에 태그를 사용할수 없어서 생기는 부분입니다.
php 내에 코멘트 내용부분에 데이터 저장시 태그 치환을 했다가 출력시에 다시 치환해서 받아 해야할거 같군요.
큰따옴표랑 작은따옴표 요고때문에 생기는 문제입니다.
코멘트 내용을 input text 폼에 내용을 담고 있기때문에 생기는거 같아요.
php를 손대지 않고도 해결가능하는데요.
소스내에 <input id='save_content_<?=$list_id?>' class="bbs_ft" type=text style='display:none;width:100%;height:23; padding:4;' value="<?=$list[$i][wr_content]?>">
이부분에서 아래소스처럼 textarea 태그를 활용해보시는 방법이 있어요.
또는 $list[$i][wr_content] 출력되는 내용에서 큰따옴표만 해결하시면 될것같습니다.
<textarea id='save_content_<?=$list_id?> class="bbs_ft" style='display:none;width:100%;height:23; padding:4;'><?=$list[$i][wr_content]?></textarea>
답변을 작성하시기 전에 로그인 해주세요.