Last 7 days | Last 30 days' . "\n";
$date = ($_GET['d'] == 7) ? date('Y-m-d', strtotime("-7 days")) : date('Y-m-d', strtotime("-30 days"));
echo 'Since ' . date('F d, Y', strtotime($date)) . '
' . "\n";
$query = 'select count(*) count, restaurant from rest_clikthru where `clikdate` >= \'' . $date . '\' group by restaurant order by count desc, restaurant';
if (!($res = $mysqli->query($query)))
printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error);
while ($row = $res->fetch_assoc())
{
extract($row);
// $pos = strpos($restaurant, 'thedailycourier.com');
// $restaurant = substr($restaurant, ($pos+19));
// $restaurant = str_replace('index.html', '', $restaurant);
$counts[7][] = array($count, $restaurant);
}
/*
$query = 'select count(*) count, restaurant from rest_clikthru group by restaurant order by count desc, restaurant';
if (!($res = $mysqli->query($query)))
printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error);
while ($row = $res->fetch_assoc())
{
extract($row);
// $pos = strpos($restaurant, 'thedailycourier.com');
// $restaurant = substr($restaurant, ($pos+19));
// $restaurant = str_replace('index.html', '', $restaurant);
$counts[0][] = array($count, $restaurant);
}
$date = date('Y-m-d', strtotime("-7 days"));
$query = 'select count(*) count, restaurant from rest_clikthru where `clikdate` >= \'' . $date . '\' group by restaurant order by count desc, restaurant';
if (!($res = $mysqli->query($query)))
printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error);
while ($row = $res->fetch_assoc())
{
extract($row);
// $pos = strpos($restaurant, 'thedailycourier.com');
// $restaurant = substr($restaurant, ($pos+19));
// $restaurant = str_replace('index.html', '', $restaurant);
$counts[7][] = array($count, $restaurant);
}
$date = date('Y-m-d', strtotime("-30 days"));
$query = 'select count(*) count, restaurant from rest_clikthru where `clikdate` >= \'' . $date . '\' group by restaurant order by count desc, restaurant';
if (!($res = $mysqli->query($query)))
printf("Error in MySQL: %d (%s)\n", $mysqli->errno, $mysqli->error);
while ($row = $res->fetch_assoc())
{
extract($row);
// $pos = strpos($restaurant, 'thedailycourier.com');
// $restaurant = substr($restaurant, ($pos+19));
// $restaurant = str_replace('index.html', '', $restaurant);
$counts[30][] = array($count, $restaurant);
}
*/
$mysqli->close();
//pecho($query);
?>
Burst clik-thru stats
' . "\n";
$str .= '| | ';
$str .= ' ' . $varr[1] . ' | ' . "\n";
$str .= ' ' . $varr[0] . ' | ';
$str .= '' . "\n";
$tot_count += $varr[0];
}
$str .= '' . "\n";
$str .= '| | ';
$str .= ' | ';
$str .= '' . $tot_count . ' | ';
$str .= '
' . "\n";
echo $str;
$str = '' . "\n";
$str .= '| Clicks in the past 30 days: | ' . "\n";
$str .= '
' . "\n";
$tot_count = 0;
$bgc = '#FFFFFF';
/*
foreach($counts[30] as $varr)
{
$bgc = ($bgc == '#FFFFFF') ? '#E9E9E9' : '#FFFFFF';
$str .= '' . "\n";
$str .= '| | ';
$str .= ' ' . $varr[1] . ' | ' . "\n";
$str .= ' ' . $varr[0] . ' | ';
$str .= '
' . "\n";
$tot_count += $varr[0];
}
$str .= '' . "\n";
$str .= '| | ';
$str .= ' | ';
$str .= '' . $tot_count . ' | ';
$str .= '
' . "\n";
echo $str;
$str = '' . "\n";
$str .= '| Total clicks since 2008-10-30: | ' . "\n";
$str .= '
' . "\n";
$tot_count = 0;
$bgc = '#FFFFFF';
foreach($counts[0] as $varr)
{
$bgc = ($bgc == '#FFFFFF') ? '#E9E9E9' : '#FFFFFF';
$str .= '' . "\n";
$str .= '| | ';
$str .= ' ' . $varr[1] . ' | ' . "\n";
$str .= ' ' . $varr[0] . ' | ';
$str .= '
' . "\n";
$tot_count += $varr[0];
}
$str .= '' . "\n";
$str .= '| | ';
$str .= ' | ';
$str .= '' . $tot_count . ' | ';
$str .= '
' . "\n";
echo $str;
#$str .= '' . "\n";
#$str .= '| Clicks in the past 30 days: | ' . $month_count . ' | ' . "\n";
#$str .= '
' . "\n";
#$str .= '' . "\n";
#$str .= '| Clicks in the past seven days: | ' . $week_count . ' | ' . "\n";
#$str .= '
' . "\n";
*/
?>