답변글을 한번 이상 쓰지 못하게 하기 정보
답변글을 한번 이상 쓰지 못하게 하기본문
해당 원글에 대한 답변글을 회원인 경우 한번 이상 못쓰게 하고 싶습니다.
종전에 엑스엠엘님께서 해당원글에 대한 갯수는 응용해서 뽑아 쓰는데 ...
아무리 응용해도 안되네요.
아시는 분 좀 부탁드립니다.... 저녁 맛있게 드세요..
종전에 엑스엠엘님께서 해당원글에 대한 갯수는 응용해서 뽑아 쓰는데 ...
아무리 응용해도 안되네요.
아시는 분 좀 부탁드립니다.... 저녁 맛있게 드세요..
댓글 전체
회원 아이디가 확실히 기억이 안나는데요.. 그누보드 답변글 참고해서 하니까 되네요..
아래의소스를 스킨의 write.skin.php 의 상단부에 삽입하니까.. 되네요...
참고바랍니다.
//== 댓글한번만 달리게 하기 ==
function write_alert($whn='',$ud='',$type='',$table='',$wid='',$itime='',$except='') {
global $g4;
global $member;
global $wr_id;
global $is_admin;
if (!$wr_id) $wr_id = $wid;
$except = 0;
if ($except) {
$except_arr = explode("|",chop($except)); //제외게시판
if (in_array($table,$except_arr)) $except = 1;
}
$bo_table_name ="".$g4[write_prefix]."".$table."";
if($member[mb_id] && !$is_admin && $whn && $ud && $table && (!$wid || $wid == $wr_id) && !$except)
{
if ($itime) {
//사용가능 시간지정
$udatatime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * $itime));
$ins_time = "and wr_datetime >= '$udatatime'"; //유효시간 조건
$pment_time = "{$itime}시간 내에 ";
}
if ($type == "a") {
$pment = "글 (답글,코멘트포함)";
$ab_board =@mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where mb_id ='$member[mb_id]' $ins_time"));
} else if ($type == "r") {
$pment = "답글";
if ($wid) {
$arr =@mysql_fetch_array(mysql_query("select wr_num from $bo_table_name where wr_id='$wid'"));
$ins = "and wr_num = $arr[0]"; //답글의 어미 원글 안에서로 조건 축소
}
$ab_board =@mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_reply !='' $ins $ins_time and mb_id ='$member[mb_id]'"));
} else if ($type == "c") {
$pment = "코멘트";
if ($wid) {$ins = "and wr_parent = $wid";} //코멘트의 원글 안에서로 조건 축소
$ab_board =@mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='1' $ins $ins_time and wr_reply ='' and mb_id ='$member[mb_id]'"));
} else {
$pment = "원글";
$ab_board =@mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='0' and wr_reply ='' $ins_time and mb_id ='$member[mb_id]'"));
}
$row = @sql_fetch_array(sql_query("select bo_subject from $g4[board_table] where bo_table = '$table'")); //게시판 이름 가져오기
$rowmember =$ab_board[0]; //글갯수
if($ud == "down" && $rowmember < $whn) { //$whn 보다 작으면 불합격 이전페이지로 이동
//alert("[{$row[bo_subject]} {$wid}] 게시판에 {$pment_time}{$whn}개 이상 $pment 작성을 하셔야만 이용하실 수 있습니다. \\n\\n (현재 {$member[mb_nick]}님의 $pment : {$rowmember}개)");
alert("[{$row[bo_subject]}] 게시판에 {$pment_time}{$whn}개 이상 $pment 작성을 하셔야만 이용하실 수 있습니다. \\n\\n (현재 {$member[mb_nick]}님의 $pment : {$rowmember}개)", "./board.php?bo_table=$table");
}
if($ud == "up" && $rowmember >= $whn) { //$whn 이상이면 불합격 이전페이지로 이동
alert("현재 {$pment_time}{$whn}개 이상의 신청을 이미 하셨으므로 이용하실 수 없습니다.");
}
}
return;
}
?>
<? if ($w == 'u') { // -- 글수정이라면 --
//write_alert(1,'up','r','san03',$wr_id);//★글(원글,답글,코멘트) 쓴 갯수로 사용 제한하기 - 회원전용
}else{
write_alert(1,'up','r','san03',$wr_id);//★글(원글,답글,코멘트) 쓴 갯수로 사용 제한하기 - 회원전용
}
//== 댓글한번만 달리게 하기 ==
?>
아래의소스를 스킨의 write.skin.php 의 상단부에 삽입하니까.. 되네요...
참고바랍니다.
//== 댓글한번만 달리게 하기 ==
function write_alert($whn='',$ud='',$type='',$table='',$wid='',$itime='',$except='') {
global $g4;
global $member;
global $wr_id;
global $is_admin;
if (!$wr_id) $wr_id = $wid;
$except = 0;
if ($except) {
$except_arr = explode("|",chop($except)); //제외게시판
if (in_array($table,$except_arr)) $except = 1;
}
$bo_table_name ="".$g4[write_prefix]."".$table."";
if($member[mb_id] && !$is_admin && $whn && $ud && $table && (!$wid || $wid == $wr_id) && !$except)
{
if ($itime) {
//사용가능 시간지정
$udatatime = date("Y-m-d H:i:s", time() - (int)(60 * 60 * $itime));
$ins_time = "and wr_datetime >= '$udatatime'"; //유효시간 조건
$pment_time = "{$itime}시간 내에 ";
}
if ($type == "a") {
$pment = "글 (답글,코멘트포함)";
$ab_board =@mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where mb_id ='$member[mb_id]' $ins_time"));
} else if ($type == "r") {
$pment = "답글";
if ($wid) {
$arr =@mysql_fetch_array(mysql_query("select wr_num from $bo_table_name where wr_id='$wid'"));
$ins = "and wr_num = $arr[0]"; //답글의 어미 원글 안에서로 조건 축소
}
$ab_board =@mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_reply !='' $ins $ins_time and mb_id ='$member[mb_id]'"));
} else if ($type == "c") {
$pment = "코멘트";
if ($wid) {$ins = "and wr_parent = $wid";} //코멘트의 원글 안에서로 조건 축소
$ab_board =@mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='1' $ins $ins_time and wr_reply ='' and mb_id ='$member[mb_id]'"));
} else {
$pment = "원글";
$ab_board =@mysql_fetch_array(mysql_query("select count(*) from $bo_table_name where wr_is_comment ='0' and wr_reply ='' $ins_time and mb_id ='$member[mb_id]'"));
}
$row = @sql_fetch_array(sql_query("select bo_subject from $g4[board_table] where bo_table = '$table'")); //게시판 이름 가져오기
$rowmember =$ab_board[0]; //글갯수
if($ud == "down" && $rowmember < $whn) { //$whn 보다 작으면 불합격 이전페이지로 이동
//alert("[{$row[bo_subject]} {$wid}] 게시판에 {$pment_time}{$whn}개 이상 $pment 작성을 하셔야만 이용하실 수 있습니다. \\n\\n (현재 {$member[mb_nick]}님의 $pment : {$rowmember}개)");
alert("[{$row[bo_subject]}] 게시판에 {$pment_time}{$whn}개 이상 $pment 작성을 하셔야만 이용하실 수 있습니다. \\n\\n (현재 {$member[mb_nick]}님의 $pment : {$rowmember}개)", "./board.php?bo_table=$table");
}
if($ud == "up" && $rowmember >= $whn) { //$whn 이상이면 불합격 이전페이지로 이동
alert("현재 {$pment_time}{$whn}개 이상의 신청을 이미 하셨으므로 이용하실 수 없습니다.");
}
}
return;
}
?>
<? if ($w == 'u') { // -- 글수정이라면 --
//write_alert(1,'up','r','san03',$wr_id);//★글(원글,답글,코멘트) 쓴 갯수로 사용 제한하기 - 회원전용
}else{
write_alert(1,'up','r','san03',$wr_id);//★글(원글,답글,코멘트) 쓴 갯수로 사용 제한하기 - 회원전용
}
//== 댓글한번만 달리게 하기 ==
?>