<?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";
// init
$ip_converted = array();
for ($i=0;$i<24;$i++)
$ip_converted_hours[$i] = array();
$rs_vr = array();
$rs_vr_w = 0;
$rs_h = array();
if (file_exists(DATABASE_PATH.$tablename))
{
$fp = fopen (DATABASE_PATH.$tablename,"r");
while ($data = fgetcsv ($fp, 1000, ","))
{
if (!$ip_converted[$data[3]])
{
$ip_converted[$data[3]] = 1;
$rs_vr_w++;
}
$rs_h["x".$data[0]]++;
if (!$ip_converted_hours[$data[0]][$data[3]])
{
$ip_converted_hours[$data[0]][$data[3]]++;
$rs_vr["x".$data[0]]++;
}
}
fclose ($fp);
}
$total = array();
$month = array();
$day = array();
$tot_h = 0;
$tot_vr = 0;
// update
foreach ($rs_h as $item => $value)
{
$total[$item]["h"] += $value;
$month[$item]["h"] += $value;
$day[$item]["h"] += $value;
$tot_h += $value;
}
foreach ($rs_vr as $item => $value)
{
$total[$item]["vr"] += $value;
$month[$item]["vr"] += $value;
$day[$item]["vr"] += $value;
$tot_vr += $value;
}
$tot_vr_w = $rs_vr_w;
$weekday = array();
// update
$n_weekday = date("w");
$weekday["x".$n_weekday]["h"] += $tot_h;
$weekday["x".$n_weekday]["vr"] += $tot_vr_w;
// save database
$arr["hours_total"] = $total;
$arr["hours_month"] = $month;
$arr["hours_day"] = $day;
$arr["weekday"] = $weekday;
$str = serialize($arr);
?>