소스좀 봐주세요...24시간이 지나면 0부터 다시시작하게...하고싶은데.. > 그누4 질문답변

그누4 질문답변

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

소스좀 봐주세요...24시간이 지나면 0부터 다시시작하게...하고싶은데.. 정보

소스좀 봐주세요...24시간이 지나면 0부터 다시시작하게...하고싶은데..

본문

<?
function hitcount()
{
//$file_count = "count.txt";
$file_date = "./counter/count_date";
$dcount = 0;
if ( !file_exists($file_date)){
        touch ($file_date);
        $handle = fopen ($file_date, 'r+'); // Let's open for read and write
        $dcount = 0;
}
else{
        $handle = fopen ($file_date, 'rw'); // Let's open for read and write
        $contents = fread($handle, filesize($file_date));
        //settype ($count,"integer");
$contents = trim($contents,'|');
$content = split("\|",$contents);
$dcount = $content[0];
$omtime = $content[1];
$nmtime = date("m-d-Y", filemtime($file_date));
//echo "$count<br>$omtime<br>$nmtime";
if ($omtime != $nmtime)
$dcount = 0;
@fclose($handle);
}
//rewind ($handle); // Go back to the beginning
$contents = ++$dcount . "|" . $nmtime;// . "|";
//$contents = trim($contents,"[ |]");
$handle = fopen($file_date, 'w'); // Let's open for read and write
fwrite ($handle, $contents); // Don't forget to increment the counter
fclose ($handle); // Done

// return $count;
$file = fopen("./counter/count.txt", "r");
$count = fread($file, 1024);
fclose($file);
//Increasing the count
$count = explode("=", $count);
//$count[1] = $count[1]+1;
$count[1] = $dcount;
//Writing to file
$file = fopen("./counter/count.txt", "w+");
fwrite($file, "count=".$count[1]);
fclose($file);
//print "count=".$count[1];

}     
hitcount();
?>

---------------------------------------------------------------------------------------

계속 저녁12시되면 카운트가 0으로 되서 시작하는게 아니라, 아무시간때나 자꾸 0으로 바껴서 다시 시작해 버립니다. 저녁 12시에 딱 0으로 시작하게끔 하고 싶은데... 소스에 문제가 있는거 아닌가요?어떻게 하면되나요..?;;

댓글 전체

전체 30 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT