Location: PHPKode > projects > Ads Exchange Server > estigi_0.1.1_RC2/r2.php
<?php

/***************************************************************************
 *                             reports.php
 *                            -------------------
 *   begin                : mier, set 27, 2007
 *   copyright            : (C)
 *   email                : hide@address.com
 *   Desc                 : General reports generation
 *
 *
 ***************************************************************************/

define('IN_ADSERVER', true);

include_once("./inc/common.inc.php");

checkLogin($web_address);

$s_Warning = "";

//Check appropiate permissions
get_User_Settings($session['id_User'], "reports", $web_address);

if(isset($_GET['type']) && $_GET['type'] != ""){

	//Agency breakdown
	if($_GET['type'] == "ab"){

		$q = "
			SELECT id_Ads, dimensions, views, clicks, text, ".$db_Pre."users.user_Name
			FROM ".$db_Pre."ads
			INNER JOIN ".$db_Pre."zones ON ".$db_Pre."zones.id_Zone = ".$db_Pre."ads.Id_Zone
			INNER JOIN ".$db_Pre."users ON ".$db_Pre."ads.id_User = ".$db_Pre."users.id_User
			ORDER BY ".$db_Pre."users.user_Name, ".$db_Pre."zones.text, ".$db_Pre."ads.id_Ads
			";

		$q_Get_Data = mysql_query($q) or die("Unable to Create Report: " . mysql_error());

		exportCSV($q_Get_Data, $_lang['reports_Rep_User_Break'], array($_lang['reports_Ad_Id'],$_lang['reports_Ad_Dim'],$_lang['reports_Views'],$_lang['reports_Clicks'], $_lang['reports_Text'], $_lang['reports_User_Name']));

	}

	//Full Display Dump
	else if($_GET['type'] == "full_Dump"){

		$q = "
			SELECT ".$db_Pre."view_Log.id_Ads, place, FROM_UNIXTIME( ".$db_Pre."view_Log.timestamp ) , clicked, ".$db_Pre."view_Log.data, ".$db_Pre."users.user_Name
			FROM ".$db_Pre."view_Log
			INNER JOIN ".$db_Pre."ads ON ".$db_Pre."ads.id_Ads = ".$db_Pre."view_Log.id_Ads
			INNER JOIN ".$db_Pre."users ON ".$db_Pre."ads.id_User = ".$db_Pre."users.id_User
			ORDER BY ".$db_Pre."users.user_Name, ".$db_Pre."ads.id_Ads";

/*
		$q = "
			SELECT id_Ads, place, FROM_UNIXTIME(".$db_Pre."view_Log.timestamp) AS time_Viewed, clicked, data, ".$db_Pre."users.user_Name
			FROM ".$db_Pre."view_Log
			INNER JOIN ".$db_Pre."users ON ".$db_Pre."ads.id_User = ".$db_Pre."users.id_User
			ORDER BY ".$db_Pre."users.user_Name, ".$db_Pre."ads.id_Ads
			";
*/
		$q_Get_Data = mysql_query($q) or die("Unable to Create Report: " . mysql_error());

		exportCSV($q_Get_Data, $_lang['reports_Rep_Full_Dump'] . "_" . date("Ymd", time()) , array($_lang['reports_Ad_Id'],$_lang['reports_Place'],$_lang['reports_Time'],$_lang['reports_Clicked'], $_lang['reports_Data'], $_lang['reports_User_Name']));

	}

}

?>
Return current item: Ads Exchange Server