출석부 개근시 포인트 수정 좀 알려주세요

출석부 개근시 포인트 수정 좀 알려주세요

QA

출석부 개근시 포인트 수정 좀 알려주세요

답변 3

본문


<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
if ($w == '' && $is_list) {
    // 한번만 출석체크
    if ($member['mb_id']) {
        $bo_1 = $board['bo_1'] ? explode('|', $board['bo_1']) : array(); // 자동 출석체크 문구
        unset($tmp);
        if ($is_admin != 'super') {
            $tmp = sql_fetch("select count(wr_id) as cnt from {$write_table} where wr_is_comment = 0 and wr_reply = '' and mb_id = '{$member['mb_id']}' and left(wr_datetime,10) = '".G5_TIME_YMD."'");
            if (intval($tmp['cnt']) > 0) {
                alert('오늘은 이미 출석체크를 하셨습니다.\n출석체크는 하루에 한번만 할 수 있습니다.');
                goto_url(short_url_clean(G5_HTTP_BBS_URL.'/board.php?bo_table='.$bo_table));
            }
        }
    }
}
 

 

현재 이상태입니다

 

15일개근시 5000 포인트

 

30일 개근시 10000 포인트

 

 

3109820438_1616600392.1163.png

 

3109820438_1616600334.9248.png

 

3109820438_1616600415.9291.png

이 질문에 댓글 쓰기 :

답변 3

write_update.tail.skin.php 파일에 아래 소스를 추가


    $cnt = 0;
    $sql = sql_query("select * from {$write_table} where wr_is_comment = 0 and wr_reply = '' and mb_id = '{$member['mb_id']}' order by wr_datetime desc");
    while($i=0; $row = sql_fetch_array($sql); $i++) {
        $wr_date = date('Y-m-d', time()-60*60*24*$i);
        if($wr_date == substr($row['wr_datetime'],0,10)) {
            $cnt++;
            if($cnt==15) {
                insert_point($member['mb_id'], 5000, "{$board['bo_subject']} 15일개근", $bo_table, $wr_id, '개근');
            } else if($cnt==30) {
                insert_point($member['mb_id'], 10000, "{$board['bo_subject']} 30일개근", $bo_table, $wr_id, '개근');
                break;
            }
        } else {
            break;
        }
    }
출석부로 쓰이는 게시판이 회원 개인마다 하루에 한 번씩 게시물이 생기는 거라면

    if ($member['mb_id']) {
        $bo_1 = $board['bo_1'] ? explode('|', $board['bo_1']) : array(); // 자동 출석체크 문구
        unset($tmp);
        if ($is_admin != 'super' && 출석 포인트 받은 날짜가 15일 지났다면 ) {
            $tmp = sql_fetch("select count(wr_id) as cnt from {$write_table} where wr_is_comment = 0 and wr_reply = '' and mb_id = '{$member['mb_id']}' and wr_datetime > curdate - interval 30 day");
            if (intval($tmp['cnt']) >= 30) 
                insert_point($member['mb_id'], 10000, "{$board['bo_subject']} 30일개근", $bo_table, $wr_id, '개근');



            $tmp = sql_fetch("select count(wr_id) as cnt from {$write_table} where wr_is_comment = 0 and wr_reply = '' and mb_id = '{$member['mb_id']}' and wr_datetime > curdate - interval 15 day");
            if (intval($tmp['cnt']) >= 15) 
                insert_point($member['mb_id'], 5000, "{$board['bo_subject']} 15일개근", $bo_table, $wr_id, '개근');




            
        }
    }

이런 식이어야 할 듯합니다.

while($i=0; $row = sql_fetch_array($sql); $i++) {

 

=>

 

while($row = sql_fetch_array($sql)) {

 

또는

 

for($i=0; $row = sql_fetch_array($sql); $i++) {

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 1
© SIRSOFT
현재 페이지 제일 처음으로