4일째 고전중인 코드.. > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

4일째 고전중인 코드.. 정보

4일째 고전중인 코드..

본문

$list_i = $list[$i][wr_id];       
$down_count = sql_fetch(" select unix_timestamp(MAX(po_datetime)) as cnt_out from $g4[point_table] where mb_id = '$member[mb_id]' and po_rel_table = '$bo_table' and po_rel_id = '$list_i' ");
$down_count_out = $down_count[cnt_out];
$down_s = 120; $down_limit = $down_count_out + $down_s;
 
 if($g4[server_time] > $down_limit) {
        // 게시물당 한번만 차감하도록 수정
//      insert_point($member[mb_id], $board[bo_download_point], "$board[bo_subject] $wr_id" , $bo_table, $wr_id, $g4[server_time])
}


어제도 적었습니다만...

이렇게 하면 분명히 120초가 지나기 전까지는 포인트가 차감 안되야하는데 계속 차감 됩니다..

도데체 왜일까요....으아아아아아아앙ㅇㅇㅇㅇ
  • 복사

댓글 전체

유닉스타임 처리가 안맞나 봅니다.
아래코드로 테스트 해보십시오

$list_i = $list[$i][wr_id];       
//$down_count = sql_fetch(" select unix_timestamp(MAX(po_datetime)) as cnt_out from $g4[point_table] where mb_id = '$member[mb_id]' and po_rel_table = '$bo_table' and po_rel_id = '$list_i' ");
$down_count = sql_fetch(" select MAX(po_datetime) as cnt_out from $g4[point_table] where mb_id = '$member[mb_id]' and po_rel_table = '$bo_table' and po_rel_id = '$list_i' ");
//$down_count_out = $down_count['cnt_out'];
//$down_s = 120;
//$down_limit = $down_count_out + $down_s;
$down_limit = date("{$down_count['cnt_out']}", strtotime("+120 seconds"))

 
 //if($g4[server_time] > $down_limit) {
if($g4['time_ymdhis'] > $down_limit) {
        // 게시물당 한번만 차감하도록 수정
//      insert_point($member[mb_id], $board[bo_download_point], "$board[bo_subject] $wr_id" , $bo_table, $wr_id, $g4[server_time])
}
테스트 해봤습니다만 안되네요,

if($g4['time_ymdhis'] > $down_limit) {

의 조건문이랑 관계없이 무조건 성립 됩니다..
무조건 성립되서 무조건 차감 됩니다..나원 이런 경우가..........
코드가 상으론 문제가 없습니다.
아래쿼리에서
$down_count = sql_fetch(" select MAX(po_datetime) as cnt_out from $g4[point_table] where mb_id = '$member[mb_id]' and po_rel_table = '$bo_table' and po_rel_id = '$list_i' ");

po_rel_table 과 po_rel_id 가 제대로 일치하는지 조건문을 확인해보시기 바랍니다.
© SIRSOFT
현재 페이지 제일 처음으로