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

2021-03-25 (목) 00:27:01 2,106

Copy
<?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개 / 댓글 6개

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

=>

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

또는

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

답변에 대한 댓글 1개

감사합니다.
2021-03-25 (목) 09:31:06
출석부로 쓰이는 게시판이 회원 개인마다 하루에 한 번씩 게시물이 생기는 거라면
Copy
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, '개근');




            
        }
    }

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

답변에 대한 댓글 2개

출석 포인트 받은 날짜가 15일 지났다면 <-이부분
" 출석 포인트 받은 날짜가 15일 지났다면 " 오류떠서 이렇게 바꾸니깐 되던데 맞나요?
당연히 문장 내용에 맞는 스크립트를 작성해서 조건을 if문에 넣어 줘야죠.

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

Copy
$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;

        }

    }

답변에 대한 댓글 3개

감사합니다.
while($i=0; $row = sql_fetch_array($sql); $i++) {

이부분에 구문오류가 있습니다 라고 뜨는데요? 어떻게 해야하나요?
제가 실수했네요..^^;;
for($i=0; $row = sql_fetch_array($sql); $i++) {

답변을 작성하려면 로그인이 필요합니다.