<?php
/***************************************************************************
* reports_resume.php
* -------------------
* begin : mier, ago 29, 2007
* copyright : (C)
* email : hide@address.com
* Desc : Users general report
*
*
***************************************************************************/
if ( !defined('IN_ADSERVER') ) {
die("Hacking attempt");
}
/* If global*/
if($global_Reports == 0){
$where = " WHERE id_User = ".$session['id_User'];
}
else{
$where = "";
}
/* Banners statistics */
$q = "
SELECT count(id_Ads) AS tot_Ads, sum(views) AS tot_Views, sum(clicks) AS tot_Clicks
FROM ".$db_Pre."ads
".$where;
$q_Stats = mysql_query($q) or die("Unable to Get Statistiscs 1: " . mysql_error());
$row = mysql_fetch_array($q_Stats, MYSQL_ASSOC);
{
$i_Total_Ads = $row['tot_Ads'];
$i_Total_Displayed = ($row['tot_Views'] != "" ? $row['tot_Views'] : 0);
$i_Total_Clicks = ($row['tot_Clicks'] != "" ? $row['tot_Clicks'] : 0);
}
/* Credits */
$q = "
SELECT sum(credits) AS credits
FROM ".$db_Pre."credits
".$where;
$q_Stats = mysql_query($q) or die("Unable to Get Statistiscs 2: " . mysql_error());
$row = mysql_fetch_array($q_Stats, MYSQL_ASSOC);
{
$i_Remaining_Credits = ($row['credits'] != "" ? $row['credits'] : 0 );
}
$reports_Resume_Tpl = new tpl($s_path_Tpl . "/reports_resume.tpl");
$a_Reports_Resume = array(
"{REPS_TITLE}" => $_lang['reports_Res_Title'],
"{REPS_TOTAL}" => $_lang['reports_Res_Tot_Ads'],
"{REPS_TOTAL_V}" => $i_Total_Ads,
"{REPS_TOTAL_DISPLAY}" => $_lang['reports_Res_Disp'],
"{REPS_DISPLAY_V}" => $i_Total_Displayed,
"{REPS_TOTAL_CLICKS}" => $_lang['reports_Res_Clicks'],
"{REPS_CLICKS_V}" => $i_Total_Clicks,
"{REPS_RATIO}" => $_lang['reports_Res_Ratio'],
"{REPS_RATIO_V}" => ($i_Total_Displayed != 0 ? (round($i_Total_Clicks / $i_Total_Displayed, 2) * 100) : 0),
"{REPS_REMAINING}" => $_lang['reports_Res_Remaining'],
"{REPS_REMAINING_V}" => ($i_Remaining_Credits == -1 ? "Unlimited" : $i_Remaining_Credits)
);
/* Replace main TPL */
$reports_Resume_Tpl->rBlock($a_Reports_Resume, "");
if($global_Reports == 1){
$reports_Resume_Tpl = $reports_Resume_Tpl->getTpl();
}
else{
/* Print the tpl */
$reports_Resume_Tpl->print_Tpl();
}
?>