시간 당 추천 횟수 제한 .. 가능할까요 ?
현재 배추스킨을 이용하고 있어 하루 제한량 설정이 가능한데
이것을 시간으로 쪼개면 가능할 것 같긴하지만.. 그걸 어떻게 해야할 지 도무지 감이잡히질 않아 이렇게 질문글 남깁니다.
배추스킨의 하루 추천 제한 소스부분 입니다.
if ($mw_basic[cf_good_count]) {
$sql = " select count(*) as cnt from $g4[board_good_table] where bo_table = '$bo_table' and mb_id = '$member[mb_id]' and bg_datetime like '$g4[time_ymd]%' ";
$tm1 = sql_fetch($sql);
$sql = " select count(*) as cnt from $mw[comment_good_table] where bo_table = '$bo_table' and mb_id = '$member[mb_id]' and bg_datetime like '$g4[time_ymd]%' ";
$tm2 = sql_fetch($sql);
if ($tm1[cnt]+$tm2[cnt] >= $mw_basic[cf_good_count])
die("추천/비추천은 하루에 $mw_basic[cf_good_count]번만 가능합니다.");
}
도대체 어떤 부분을 수정해야 시간 당 추천 제한이 가능할까요 ㅠㅠ!
이것을 시간으로 쪼개면 가능할 것 같긴하지만.. 그걸 어떻게 해야할 지 도무지 감이잡히질 않아 이렇게 질문글 남깁니다.
배추스킨의 하루 추천 제한 소스부분 입니다.
if ($mw_basic[cf_good_count]) {
$sql = " select count(*) as cnt from $g4[board_good_table] where bo_table = '$bo_table' and mb_id = '$member[mb_id]' and bg_datetime like '$g4[time_ymd]%' ";
$tm1 = sql_fetch($sql);
$sql = " select count(*) as cnt from $mw[comment_good_table] where bo_table = '$bo_table' and mb_id = '$member[mb_id]' and bg_datetime like '$g4[time_ymd]%' ";
$tm2 = sql_fetch($sql);
if ($tm1[cnt]+$tm2[cnt] >= $mw_basic[cf_good_count])
die("추천/비추천은 하루에 $mw_basic[cf_good_count]번만 가능합니다.");
}
도대체 어떤 부분을 수정해야 시간 당 추천 제한이 가능할까요 ㅠㅠ!
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기
댓글 5개
시간으로 수정하실려면 bg_datetime의 조건절만 수정하시면 됩니다.
일단 global 변수로 선언된 하루추천 제한량을 1시간추천 제한량이라고 생각하고 수정하겠습니다.
위 쿼리문 생성할때 $g4[time_ymd] 를 date("Y-m-d H", $g4['server_time']) 바꿔주시면 됩니다.
if ($mw_basic[cf_good_count]) {
$sql = " select count(*) as cnt from $g4[board_good_table] where bo_table = '$bo_table' and mb_id = '$member[mb_id]' and bg_datetime like '".date("Y-m-d H", $g4['server_time'])."%' "; $tm1 = sql_fetch($sql);
$sql = " select count(*) as cnt from $mw[comment_good_table] where bo_table = '$bo_table' and mb_id = '$member[mb_id]' and bg_datetime like '".date("Y-m-d H", $g4['server_time'])."%' ";
$tm2 = sql_fetch($sql);
if ($tm1[cnt]+$tm2[cnt] >= $mw_basic[cf_good_count])
die("추천/비추천은 1시간에 $mw_basic[cf_good_count]번만 가능합니다.");
}
아니면 config.php 파일에
$g4['time_ymdh'] = date("Y-m-d H", $g4['server_time']); 를 추가해주시고
아래처럼 수정해보시기 바랍니다.
if ($mw_basic[cf_good_count]) {
$sql = " select count(*) as cnt from $g4[board_good_table] where bo_table = '$bo_table' and mb_id = '$member[mb_id]' and bg_datetime like '$g4[time_ymdh]%' ";
$tm1 = sql_fetch($sql);
$sql = " select count(*) as cnt from $mw[comment_good_table] where bo_table = '$bo_table' and mb_id = '$member[mb_id]' and bg_datetime like '$g4[time_ymdh]%' ";
$tm2 = sql_fetch($sql);
if ($tm1[cnt]+$tm2[cnt] >= $mw_basic[cf_good_count])
die("추천/비추천은 1시간에 $mw_basic[cf_good_count]번만 가능합니다.");
}
1년 전에도 도움주셨던 강한남v 님 !!..
정말 감사합니다 !
냑 활동을 간간히 해서.. 이제 열심히 해볼려구요.ㅋㅋ
자주 뵈요~~^^