묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
[php] php 카운터인데요. 이떻게 수정을 해야 하는지요.
2003.05.29 01:01
SetCookie("Counter_Cookie","count",0,"/");
$file = "counter.dat";
if(!$Counter_Cookie){
$fp=fopen($file,'r');
$contents=fread($fp,filesize($file));
fclose($fp);
$array=explode("|",$contents);
$total_count=intval($array[0]);
$today_count=intval($array[1]);
$today_date=trim($array[2]);
$current_date = date('ymd');
if($today_date != $current_date){
$today_count=1;
$today_date=$current_date;
}else{
$today_count++;
}
$total_count++;
$array = "${total_count}|${today_count}|${today_date}";
$fp=fopen($file,'w');
fwrite($fp,$array);
fclose($fp);
}
$fp=fopen($file,'r');
$contents=fread($fp,filesize($file));
fclose($fp);
$array=explode("|",$contents);
$total_count=intval($array[0]);
$today_count=intval($array[1]);
echo "Today_number=$today_count&Total_number=$total_count";
?>
여기까지 php 카운터 소스인데도..
여게보면. 하루 동아는 카운터가 작동을 하는데 .. 하루가 지나면 다시 0/0 부터 다시 카운터가 올라갑니다.~~
어떻게 수정해야 하나면!~~
$file = "counter.dat";
if(!$Counter_Cookie){
$fp=fopen($file,'r');
$contents=fread($fp,filesize($file));
fclose($fp);
$array=explode("|",$contents);
$total_count=intval($array[0]);
$today_count=intval($array[1]);
$today_date=trim($array[2]);
$current_date = date('ymd');
if($today_date != $current_date){
$today_count=1;
$today_date=$current_date;
}else{
$today_count++;
}
$total_count++;
$array = "${total_count}|${today_count}|${today_date}";
$fp=fopen($file,'w');
fwrite($fp,$array);
fclose($fp);
}
$fp=fopen($file,'r');
$contents=fread($fp,filesize($file));
fclose($fp);
$array=explode("|",$contents);
$total_count=intval($array[0]);
$today_count=intval($array[1]);
echo "Today_number=$today_count&Total_number=$total_count";
?>
여기까지 php 카운터 소스인데도..
여게보면. 하루 동아는 카운터가 작동을 하는데 .. 하루가 지나면 다시 0/0 부터 다시 카운터가 올라갑니다.~~
어떻게 수정해야 하나면!~~