PDA

View Full Version : سوال: این کد آمار سایت کمبودی نداره؟؟؟



milad_d993
پنج شنبه 30 خرداد 1392, 12:07 عصر
سلام



$c = file_get_contents("c.txt");
$counter = explode("\n",$c);
$all = explode(":",$counter[0]);
$yesterday = explode(":",$counter[1]);
$today = explode(":",$counter[2]);

$day = date("Y/m/d");
if ($day == $today[1]){

$all[1] = $all[1] + 1;
$today[2] = $today[2] + 1;

}else{
if (strtotime($day) - strtotime($today[1]) == 86400){

$all[1] = $all[1] + 1;
$yesterday[1] = $today[1];
$yesterday[2] = $today[2];

}else{

$all[1] = $all[1] + 1;
$yesterday[1] = date("Y/m/d", strtotime("$day -1 days"));
$yesterday[2] = 0;

}
$today[1] = date("Y/m/d");
$today[2] = 1;
}

$counter = "";
$counter .= "all:$all[1]\n".
"yesterday:$yesterday[1]:$yesterday[2]\n".
"today:$today[1]:$today[2]";

file_put_contents("c.txt",$counter);

تعداد افراد آنلاین و ... نمیخوام فقط بازدید امروز دیروز و کل مشکلی نداره؟؟؟