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초가 지나기 전까지는 포인트가 차감 안되야하는데 계속 차감 됩니다..
도데체 왜일까요....으아아아아아아앙ㅇㅇㅇㅇ
$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])
}
아래코드로 테스트 해보십시오
$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) {
의 조건문이랑 관계없이 무조건 성립 됩니다..
무조건 성립되서 무조건 차감 됩니다..나원 이런 경우가..........
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 가 제대로 일치하는지 조건문을 확인해보시기 바랍니다.
아래쿼리에서
$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 가 제대로 일치하는지 조건문을 확인해보시기 바랍니다.
답변 고맙습니다.
저도 혹시나 하고 확인할겸
echo 로 확인했습니다만
$down_limit 도 그렇고 po_datetime도 잘 출력 됩니다...
아 진짜 이상하네..
저도 혹시나 하고 확인할겸
echo 로 확인했습니다만
$down_limit 도 그렇고 po_datetime도 잘 출력 됩니다...
아 진짜 이상하네..
쿠키값이나 섹션값을 생성해서 그값이 있다면 더이상 실행되지 않도록 하시면 될듯합니다.
프리자인님 답변 감사합니다.
쿠키로 할려고 했지만 브라우저를 닫거나 쿠키세션 정리하면 소용이 없기에...
ㅠㅠ
쿠키로 할려고 했지만 브라우저를 닫거나 쿠키세션 정리하면 소용이 없기에...
ㅠㅠ
이전 질문의 답변 참고하세요