No days recorded in database.
break;
}
$row=mysql_fetch_row($result);
$first_day=$row[0];
$ndays = diff_of_days($first_day,$today)+1;
$ndaysf = number_format($ndays);
if ($limit>$ndays) $limit=$ndays;
$start_date = date_x_days_ago($today,$limit-1);
if (($start_date < $first_day)) $start_date = $first_day;
$strsql="SELECT * FROM stats_day WHERE date >= '$start_date' ORDER BY date DESC LIMIT 0, $limit";
if (!($result = mysql_query($strsql)))
{
$strError0="Open Stats Database Failed
";
$strError1="Error Number: ".mysql_errno().$BR;
$strError2="Error Description: ".mysql_error.$BR;
$strError5="Query: ".$strsql.$BR.$BR."strWhere: ".$strWhere.$BR;
$strError0=$BR.$strError0.$strError1.$strError2.$strError5;
echo $strError0;
break;
}
$intTotalRecs=mysql_num_rows($result);
if (($intTotalRecs==0))
{ ?>
No non-zero days recorded in database within specified range.
Hits are recorded since echo $first_day; ?> ( echo $ndaysf; ?> days)
break; } $x=0; $high_hits=0; $total_hits=0; $high_day=""; $newest_date=""; $newest2_date=""; while(($row=mysql_fetch_row($result))) { $date[$x]=$row[0]; $hits[$x]=$row[1]; $total_hits+=$row[1]; if($x==0) { $newest_date = $row[0]; $newest_hits=$row[1]; } if($x==1) { $newest2_date = $row[0]; $newest2_hits=$row[1]+$newest_hits; } if($row[1]>$high_hits) { $high_hits=$row[1]; $high_day=$row[0];} if (!isset($low_hits)) { $low_hits=$row[1]; $low_day=$row[0]; } if($row[1]<$low_hits) { $low_hits=$row[1]; $low_day=$row[0];} $x++; } $number_days=$x; # fill in array with days that had 0 hits and therefore not recorded $date[$x]="0000-00-00"; # create next array values to prevent error below $hits[$x]=0; if($number_days==$limit) {$date2=$date; $hits2=$hits;} else { $currentday=$today; $currentindex=0; for ($x=0; $x<$limit; $x++) { $date2[$x]=$currentday; if ($date[$currentindex]==$currentday) { $hits2[$x]=$hits[$currentindex]; $currentindex++; } else { $hits2[$x]=0; } if (!isset($low_hits)) { $low_hits=$hits2[0]; $low_day=$date2[0]; } if($hits2[$x]<=$low_hits) { $low_hits=$hits2[$x]; $low_day=$date2[$x];} $currentday = date_x_days_ago($currentday,1); } } $date=$date2; $hits=$hits2; $number_days=$limit; $today = date("Y") . "-" . date("m") . "-" . date("d"); $proj_hits = 0; $proj_hitsf = 0; if($newest_date==$today) { $mins = date("i") + date("G")*60.0; # minutes used today $proj_hits = $newest_hits * (1440.0/$mins); if(isset($newest2_hits)) $proj_hits = $newest_hits + ( (1440.0-$mins)*($newest2_hits/($mins+1440.0)) ); $proj_hits = round($proj_hits); $proj_hitsf = number_format($proj_hits); } $average_hits = ($total_hits + $proj_hits - $hits2[0]) / $number_days; $average_hits = round($average_hits,2); $total_hitsf = number_format($total_hits); $high_hitsf = number_format($high_hits); $low_hitsf = number_format($low_hits); $average_hitsf = number_format($average_hits); if($high_hits==0) $high2=1; else { $high2=$high_hits; if ($proj_hits>$high2) $high2=$proj_hits; } ?>
|
|
|
Free Statistics - Version 1.1.0
Copyright © 2003 Free Webspace - http://www.Free-Webhosts.com