<?php
/*
+--------------------------------------------------------------------------
| D4WStatsLittle v1.1.2 - Developers4Web Web Stats Software
| ==========================================================
| by Developers4Web.com
| D4WStatsLittle is a Trade Mark of Developers4Web
| Copyright Developers4Web 2005 - 2006. All rights reserved.
| English:
| http://stats-service.developers4web.com
| Español:
| http://www.developers4web.com
| ========================================
| optimized by Trio Solutions
| Dreamweaver Extensions and Web Development Components
| English:
| http://components.developers4web.com
| Español:
| http://componentes.developers4web.com
| ========================================
| Web: http://www.d4wstats.com
| Date: Tuesday, February 20, 2006
| Email: info (at) developers4web (dot) com
| License Type: D4WSTATSLITTLE is NOT Open Source Software and Limitations Apply
| Licence Info: /d4wstatslittle/license.txt
+--------------------------------------------------------------------------
*/
?>
<?php
require "_dbconn.inc.php";
require "common.inc.php";
////$rs_pages = mysql_query("select count(id) as ct, page from ".$tablename." group by page", $link);
// init
$rs_pages = array();
if (file_exists(DATABASE_PATH.$tablename))
{
$fp = fopen (DATABASE_PATH.$tablename,"r");
while ($data = fgetcsv ($fp, 1000, ","))
$rs_pages[$data[10]]++; // page hits
fclose ($fp);
}
$ctot = array();
$cmon = array();
$total = array();
$month = array();
$day = array();
// update
$day_h = 0;
foreach ($rs_pages as $item => $value)
{
$total[$item] += $value;
$month[$item] += $value;
$day[$item] += $value;
$day_h += $value;
}
asort($total);
if (count($total) > 25)
$total = array_slice($total, count($total)-25);
asort($month);
if (count($month) > 20)
$month = array_slice($month, count($month)-20);
asort($day);
if (count($day) > 15)
$day = array_slice($day, count($day)-15);
$arr["total"] = $total;
$arr["month"] = $month;
$arr["day"] = $day;
$arr["day_h"] = $day_h;
$arr["month_h"] = $day_h+$cmon["h"]; // nota: comprobar que esto de sumar $day_h este bien
$arr["total_h"] = $day_h+$ctot["h"]; // <- y en esa linea tambien
$str = serialize($arr);
?>