제로보드 관련된 유용한 정보를 공유하는 곳입니다.
글 수 98
18
조회 수 : 4298 신고 : 0
출처 : |
---|
1. 코멘트 수정 버튼 만들기
해당 게시판 스킨에서 view_comment.php를 열고,
소스 본문에서 <?=$a_del?> 부분을 찾아 그 앞에 <?=$a_cmod?><수정></a>을 추가.
2. 제로보드 폴더의 view.php를 수정
if($c_data[ismember]) {
if($c_data[ismember]==$member[no]||$is_admin||$member[level]<=$setup[grant_delete]) $a_del="<a onfocus=blur() href='del_comment.php?$href$sort&no=$no&c_no=$c_data[no]'>";
else $a_del=" <Zeroboard ";
} else $a_del="<a onfocus=blur() href='del_comment.php?$href$sort&no=$no&c_no=$c_data[no]'>";
------------------------*위의 부분을 아래처럼 수정*------------------------
if($c_data[ismember]) {
if($c_data[ismember]
==$member[no]||$is_admin||$member[level]<=$setup[grant_delete]) {
$a_del="<a onfocus=blur() href='del_comment.php?
$href$sort&no=$no&c_no=$c_data[no]'>";
$a_cmod="<a onfocus=blur() href='modify_comment.php?
$href$sort&no=$no&c_no=$c_data[no]'>";
}
else {
$a_del=" <Zeroboard ";
$a_cmod=" <Zeroboard ";
}
}
else {
$a_del="<a onfocus=blur() href='del_comment.php?
$href$sort&no=$no&c_no=$c_data[no]'>";
$a_cmod="<a onfocus=blur() href='modify_comment.php?
$href$sort&no=$no&c_no=$c_data[no]'>";
}
3. 제로보드 폴더의 _head.php를 수정
/***************************************************************************
* 현재 _head.php를 호출하는 파일이 게시판 관련 파일인지 검사
**************************************************************************/
$_zb_file_list = array("apply_vote.php","comment_ok.php","del_comment.php","del_comment_ok.php","delete.php","download.php","list_all.php","view.php","vote.php","write.php","write_ok.php","zboard.php","image_box.php");
------------------------*위의 부분을 아래처럼 수정*------------------------
/***************************************************************************
* 현재 _head.php를 호출하는 파일이 게시판 관련 파일인지 검사
**************************************************************************/
$_zb_file_list =
array("apply_vote.php","comment_ok.php","modify_comment.php","modify_comment_ok.php","del_comment.php","del_commen
t_ok.php","delete.php","download.php","list_all.php","view.php","vote.php","write.php","write_ok.php","zboard.php"
,"image_box.php");
4. 제로보드 폴더에 modify_comment.php를 생성 (del_comment.php를 응용)
<?
/***************************************************************************
* 공통 파일 include
**************************************************************************/
include "_head.php";
if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("정상적으로 글을 수정하여 주시기 바랍니다.");
/***************************************************************************
* 코멘트 수정 페이지 처리
**************************************************************************/
// 원본글을 가져옴
$s_data=mysql_fetch_array(mysql_query("select * from $t_comment"."_$id where no='$c_no'"));
if($s_data[ismember]||$is_admin||$member[level]<=$setup[grant_delete]) {
if(!$is_admin&&$s_data[ismember]!=$member[no]) Error("수정할 권한이 없습니다");
if ($s_data[ismember]==$member[no]) $name=$member[name];
else $name=$s_data[name];
}
$target="modify_comment_ok.php";
$memo=trim(stripslashes($s_data[memo]));
head();
include $dir."/modify_comment.php";
foot();
include "_foot.php";
?>
5. 제로보드 폴더에 modify_comment_ok.php를 생성 (comment_ok.php를 응용)
<?
/***************************************************************************
* 공통 파일 include
**************************************************************************/
include "_head.php";
if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("정상적으로 글을 수정하여 주시기 바랍니다.");
/***************************************************************************
* 코멘트 수정 진행
**************************************************************************/
// 각종 변수 검사;;
$memo = str_replace("","",$memo);
if(isblank($memo)) Error("내용을 입력하셔야 합니다");
if(!$member[no]) {
if(isblank($name)) Error("이름을 입력하셔야 합니다");
if(isblank($password)) Error("비밀번호를 입력하셔야 합니다");
}
// 필터링;; 관리자가 아닐때;;
if(!$is_admin&&$setup[use_filter]) {
$filter=explode(",",$setup[filter]);
$f_memo=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($memo));
$f_name=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($name));
$f_subject=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($subject));
$f_email=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($email));
$f_homepage=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($homepage));
for($i=0;$i<count($filter);$i++)
if(!isblank($filter[$i])) {
if(eregi($filter[$i],$f_memo)) Error("<b>$filter[$i]</b> 은(는) 등록하기에 적합한 단어가
아닙니다");
if(eregi($filter[$i],$f_name)) Error("<b>$filter[$i]</b> 은(는) 등록하기에 적합한 단어가
아닙니다");
}
}
// 패스워드를 암호화
if($password) {
$temp=mysql_fetch_array(mysql_query("select password('$password')"));
$password=$temp[0];
}
// 원본글을 가져옴
$s_data=mysql_fetch_array(mysql_query("select * from $t_comment"."_$id where no='$c_no'"));
// 회원일때를 확인;;
if(!$is_admin&&$member[level]>$setup[grant_delete]) {
if(!$s_data[ismember]) {
if($s_data[password]!=$password) Error("비밀번호가 올바르지 않습니다");
} else {
if($s_data[ismember]!=$member[no]) Error("비밀번호를 입력하여 주십시요");
}
}
// 관리자이거나 HTML허용레벨이 낮을때 태그의 금지유무를 체크
if(!$is_admin&&$setup[grant_html]<$member[level]) {
$memo=del_html($memo);// 내용의 HTML 금지;;
}
// 회원등록이 되어 있을때 이름등을 가져옴;;
if($member[no]) {
if($member[no]!=$s_data[ismember]) $name=$s_data[name];
else $name=$member[name];
}
// 각종 변수의 addslashes 시킴
$name=addslashes(del_html($name));
$memo=autolink($memo);
$memo=addslashes($memo);
// 같은 내용이 있는지 검사;;
if(!$is_admin) {
$temp=mysql_fetch_array(mysql_query("select count(*) from $t_comment"."_$id where memo='$memo' and
no='$max_no[0]'"));
if($temp[0]>0) Error("같은 내용의 글은 등록할수가 없습니다");
}
// 해당글이 있는 지를 검사
$check = mysql_fetch_array(mysql_query("select count(*) from $t_comment"."_$id where no = '$c_no'",
$connect));
if(!$check[0]) Error("원본 글이 존재하지 않습니다.");
// 코멘트 수정
mysql_query("update $t_comment"."_$id set
name='$name',memo='$memo',ismember='$s_data[ismember]',ip='$REMOTE_ADDR',
reg_date='$s_data[reg_date]' where no='$c_no'") or error(mysql_error());
@mysql_close($connect);
// 페이지 이동
if($setup[use_alllist]) movepage("zboard.php?
id=$id&page=$page&page_num=$page_num&select_arrange=$select_arrange&desc=$des&sn=$sn&ss=$ss&sc=$sc&keyword=$keywor
d&no=$no");
else movepage("view.php?
id=$id&page=$page&page_num=$page_num&select_arrange=$select_arrange&desc=$des&sn=$sn&ss=$ss&sc=$sc&keyword=$keywor
d&no=$no");
?>
6. 해당 게시판 스킨 폴더에 modify_comment.php 생성
(view_write_comment.php를 응용, nzeo_ver4 기준)
<table border=0 cellspacing=1 cellpadding=1 class=line1 width=<?=$width?>>
<tr>
<td bgcolor=white>
<table border=0 cellspacing=1 cellpadding=8 width=100% height=120 bgcolor=white>
<script>
function check_comment_submit(obj) {
if(obj.memo.value.length<10) {
alert("코멘트는 10자 이상 적어주세요");
obj.memo.focus();
return false;
}
return true;
}
</script>
<form method=post name=write action=<?=$target?> onsubmit="return
check_comment_submit(this)"><input type=hidden name=page value=<?=$page?>><input type=hidden name=id
value=<?=$id?>><input type=hidden name=no value=<?=$no?>><input type=hidden name=c_no value=<?=$c_no?>><input
type=hidden name=select_arrange value=<?=$select_arrange?>><input type=hidden name=desc value=<?=$desc?>><input
type=hidden name=page_num value=<?=$page_num?>><input type=hidden name=keyword value="<?=$keyword?>"><input
type=hidden name=category value="<?=$category?>"><input type=hidden name=sn value="<?=$sn?>"><input type=hidden
name=ss value="<?=$ss?>"><input type=hidden name=sc value="<?=$sc?>"><input type=hidden name=mode
value="<?=$mode?>">
<col width=95 align=right style=padding-right:10px></col><col width=></col><col width=95
align=right style=padding-right:10px></col><col width=></col>
<?if(!$name){?>
<tr>
<td class=list0><font class=list_eng><b>이름</b></td>
<td class=list1><font class=list_han><?=$c_name?></font><input type=text name=name
<?=size(8)?> maxlength=20 class=input></td>
<?=$hide_c_password_start?>
<td class=list0><font class=list_eng><b>암호</b></td>
<td class=list1><input type=password name=password <?=size(8)?> maxlength=20
class=input></td>
<?=$hide_c_password_end?>
</tr>
<?}?>
<tr>
<td class=list0 onclick="document.write.memo.rows=document.write.memo.rows+4"
style=cursor:hand><font class=list_eng><b>짧은글</b><br>▼</td>
<td class=list1 colspan=4>
<table border=0 cellspacing=2 cellpadding=0 width=100% height=100%>
<col width=""></col><col width=100></col>
<tr>
<td width=100% colspan=2><textarea name=memo cols=20 rows=8 class=textarea
style=width:100%><?=$memo?></textarea></td>
<td width=100 colspan=2><input type=submit rows=5 class=submit value=' 글
쓰기 ' accesskey="s" style=height:100%></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
이상 끝입니다~!
해당 게시판 스킨에서 view_comment.php를 열고,
소스 본문에서 <?=$a_del?> 부분을 찾아 그 앞에 <?=$a_cmod?><수정></a>을 추가.
2. 제로보드 폴더의 view.php를 수정
if($c_data[ismember]) {
if($c_data[ismember]==$member[no]||$is_admin||$member[level]<=$setup[grant_delete]) $a_del="<a onfocus=blur() href='del_comment.php?$href$sort&no=$no&c_no=$c_data[no]'>";
else $a_del=" <Zeroboard ";
} else $a_del="<a onfocus=blur() href='del_comment.php?$href$sort&no=$no&c_no=$c_data[no]'>";
------------------------*위의 부분을 아래처럼 수정*------------------------
if($c_data[ismember]) {
if($c_data[ismember]
==$member[no]||$is_admin||$member[level]<=$setup[grant_delete]) {
$a_del="<a onfocus=blur() href='del_comment.php?
$href$sort&no=$no&c_no=$c_data[no]'>";
$a_cmod="<a onfocus=blur() href='modify_comment.php?
$href$sort&no=$no&c_no=$c_data[no]'>";
}
else {
$a_del=" <Zeroboard ";
$a_cmod=" <Zeroboard ";
}
}
else {
$a_del="<a onfocus=blur() href='del_comment.php?
$href$sort&no=$no&c_no=$c_data[no]'>";
$a_cmod="<a onfocus=blur() href='modify_comment.php?
$href$sort&no=$no&c_no=$c_data[no]'>";
}
3. 제로보드 폴더의 _head.php를 수정
/***************************************************************************
* 현재 _head.php를 호출하는 파일이 게시판 관련 파일인지 검사
**************************************************************************/
$_zb_file_list = array("apply_vote.php","comment_ok.php","del_comment.php","del_comment_ok.php","delete.php","download.php","list_all.php","view.php","vote.php","write.php","write_ok.php","zboard.php","image_box.php");
------------------------*위의 부분을 아래처럼 수정*------------------------
/***************************************************************************
* 현재 _head.php를 호출하는 파일이 게시판 관련 파일인지 검사
**************************************************************************/
$_zb_file_list =
array("apply_vote.php","comment_ok.php","modify_comment.php","modify_comment_ok.php","del_comment.php","del_commen
t_ok.php","delete.php","download.php","list_all.php","view.php","vote.php","write.php","write_ok.php","zboard.php"
,"image_box.php");
4. 제로보드 폴더에 modify_comment.php를 생성 (del_comment.php를 응용)
<?
/***************************************************************************
* 공통 파일 include
**************************************************************************/
include "_head.php";
if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("정상적으로 글을 수정하여 주시기 바랍니다.");
/***************************************************************************
* 코멘트 수정 페이지 처리
**************************************************************************/
// 원본글을 가져옴
$s_data=mysql_fetch_array(mysql_query("select * from $t_comment"."_$id where no='$c_no'"));
if($s_data[ismember]||$is_admin||$member[level]<=$setup[grant_delete]) {
if(!$is_admin&&$s_data[ismember]!=$member[no]) Error("수정할 권한이 없습니다");
if ($s_data[ismember]==$member[no]) $name=$member[name];
else $name=$s_data[name];
}
$target="modify_comment_ok.php";
$memo=trim(stripslashes($s_data[memo]));
head();
include $dir."/modify_comment.php";
foot();
include "_foot.php";
?>
5. 제로보드 폴더에 modify_comment_ok.php를 생성 (comment_ok.php를 응용)
<?
/***************************************************************************
* 공통 파일 include
**************************************************************************/
include "_head.php";
if(!eregi($HTTP_HOST,$HTTP_REFERER)) Error("정상적으로 글을 수정하여 주시기 바랍니다.");
/***************************************************************************
* 코멘트 수정 진행
**************************************************************************/
// 각종 변수 검사;;
$memo = str_replace("","",$memo);
if(isblank($memo)) Error("내용을 입력하셔야 합니다");
if(!$member[no]) {
if(isblank($name)) Error("이름을 입력하셔야 합니다");
if(isblank($password)) Error("비밀번호를 입력하셔야 합니다");
}
// 필터링;; 관리자가 아닐때;;
if(!$is_admin&&$setup[use_filter]) {
$filter=explode(",",$setup[filter]);
$f_memo=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($memo));
$f_name=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($name));
$f_subject=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($subject));
$f_email=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($email));
$f_homepage=eregi_replace("([_-./~@?=%&! ]+)","",strip_tags($homepage));
for($i=0;$i<count($filter);$i++)
if(!isblank($filter[$i])) {
if(eregi($filter[$i],$f_memo)) Error("<b>$filter[$i]</b> 은(는) 등록하기에 적합한 단어가
아닙니다");
if(eregi($filter[$i],$f_name)) Error("<b>$filter[$i]</b> 은(는) 등록하기에 적합한 단어가
아닙니다");
}
}
// 패스워드를 암호화
if($password) {
$temp=mysql_fetch_array(mysql_query("select password('$password')"));
$password=$temp[0];
}
// 원본글을 가져옴
$s_data=mysql_fetch_array(mysql_query("select * from $t_comment"."_$id where no='$c_no'"));
// 회원일때를 확인;;
if(!$is_admin&&$member[level]>$setup[grant_delete]) {
if(!$s_data[ismember]) {
if($s_data[password]!=$password) Error("비밀번호가 올바르지 않습니다");
} else {
if($s_data[ismember]!=$member[no]) Error("비밀번호를 입력하여 주십시요");
}
}
// 관리자이거나 HTML허용레벨이 낮을때 태그의 금지유무를 체크
if(!$is_admin&&$setup[grant_html]<$member[level]) {
$memo=del_html($memo);// 내용의 HTML 금지;;
}
// 회원등록이 되어 있을때 이름등을 가져옴;;
if($member[no]) {
if($member[no]!=$s_data[ismember]) $name=$s_data[name];
else $name=$member[name];
}
// 각종 변수의 addslashes 시킴
$name=addslashes(del_html($name));
$memo=autolink($memo);
$memo=addslashes($memo);
// 같은 내용이 있는지 검사;;
if(!$is_admin) {
$temp=mysql_fetch_array(mysql_query("select count(*) from $t_comment"."_$id where memo='$memo' and
no='$max_no[0]'"));
if($temp[0]>0) Error("같은 내용의 글은 등록할수가 없습니다");
}
// 해당글이 있는 지를 검사
$check = mysql_fetch_array(mysql_query("select count(*) from $t_comment"."_$id where no = '$c_no'",
$connect));
if(!$check[0]) Error("원본 글이 존재하지 않습니다.");
// 코멘트 수정
mysql_query("update $t_comment"."_$id set
name='$name',memo='$memo',ismember='$s_data[ismember]',ip='$REMOTE_ADDR',
reg_date='$s_data[reg_date]' where no='$c_no'") or error(mysql_error());
@mysql_close($connect);
// 페이지 이동
if($setup[use_alllist]) movepage("zboard.php?
id=$id&page=$page&page_num=$page_num&select_arrange=$select_arrange&desc=$des&sn=$sn&ss=$ss&sc=$sc&keyword=$keywor
d&no=$no");
else movepage("view.php?
id=$id&page=$page&page_num=$page_num&select_arrange=$select_arrange&desc=$des&sn=$sn&ss=$ss&sc=$sc&keyword=$keywor
d&no=$no");
?>
6. 해당 게시판 스킨 폴더에 modify_comment.php 생성
(view_write_comment.php를 응용, nzeo_ver4 기준)
<table border=0 cellspacing=1 cellpadding=1 class=line1 width=<?=$width?>>
<tr>
<td bgcolor=white>
<table border=0 cellspacing=1 cellpadding=8 width=100% height=120 bgcolor=white>
<script>
function check_comment_submit(obj) {
if(obj.memo.value.length<10) {
alert("코멘트는 10자 이상 적어주세요");
obj.memo.focus();
return false;
}
return true;
}
</script>
<form method=post name=write action=<?=$target?> onsubmit="return
check_comment_submit(this)"><input type=hidden name=page value=<?=$page?>><input type=hidden name=id
value=<?=$id?>><input type=hidden name=no value=<?=$no?>><input type=hidden name=c_no value=<?=$c_no?>><input
type=hidden name=select_arrange value=<?=$select_arrange?>><input type=hidden name=desc value=<?=$desc?>><input
type=hidden name=page_num value=<?=$page_num?>><input type=hidden name=keyword value="<?=$keyword?>"><input
type=hidden name=category value="<?=$category?>"><input type=hidden name=sn value="<?=$sn?>"><input type=hidden
name=ss value="<?=$ss?>"><input type=hidden name=sc value="<?=$sc?>"><input type=hidden name=mode
value="<?=$mode?>">
<col width=95 align=right style=padding-right:10px></col><col width=></col><col width=95
align=right style=padding-right:10px></col><col width=></col>
<?if(!$name){?>
<tr>
<td class=list0><font class=list_eng><b>이름</b></td>
<td class=list1><font class=list_han><?=$c_name?></font><input type=text name=name
<?=size(8)?> maxlength=20 class=input></td>
<?=$hide_c_password_start?>
<td class=list0><font class=list_eng><b>암호</b></td>
<td class=list1><input type=password name=password <?=size(8)?> maxlength=20
class=input></td>
<?=$hide_c_password_end?>
</tr>
<?}?>
<tr>
<td class=list0 onclick="document.write.memo.rows=document.write.memo.rows+4"
style=cursor:hand><font class=list_eng><b>짧은글</b><br>▼</td>
<td class=list1 colspan=4>
<table border=0 cellspacing=2 cellpadding=0 width=100% height=100%>
<col width=""></col><col width=100></col>
<tr>
<td width=100% colspan=2><textarea name=memo cols=20 rows=8 class=textarea
style=width:100%><?=$memo?></textarea></td>
<td width=100 colspan=2><input type=submit rows=5 class=submit value=' 글
쓰기 ' accesskey="s" style=height:100%></td>
</tr>
</table>
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
이상 끝입니다~!
소중한 댓글 부탁드립니다.
추천수 10단위당 메달이 1개씩 노출되고, 추천수에 따라 배경색이 변하며, 일정수의 추천수를 받을시 아이콘이 붙게됩니다.
추천수 10단위당 메달이 1개씩 노출되고, 추천수에 따라 배경색이 변하며, 일정수의 추천수를 받을시 아이콘이 붙게됩니다.
추천수에 따른 배경색 보기
본문으로 바로가기
- 추천수 50개이상
- 추천수 30개이상
- 추천수 20개이상
- 추천수 10개이상
- 추천수 3개이상