function Plugin_GlobalhistoryExecute($delimiter = ",") { global $phpAds_config, $date_format; global $strGlobalHistory, $strTotal, $strDay, $strViews, $strClicks, $strCTRShort; header("Content-type: application/csv\nContent-Disposition: \"inline; filename=globalhistory.csv\""); if (phpAds_isUser(phpAds_Admin)) { $res_query = "\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '" . $date_format . "') as day,\n\t\t\tSUM(views) AS adviews,\n\t\t\tSUM(clicks) AS adclicks\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tGROUP BY\n\t\t\tday\n\t"; } else { $res_query = "SELECT\n\t\t\t\t\t\tDATE_FORMAT(s.day, '" . $date_format . "') as day,\n\t\t\t\t\t\tSUM(s.views) AS adviews,\n\t\t\t\t\t\tSUM(s.clicks) AS adclicks\n\t\t\t\t\tFROM\n\t\t\t\t\t\t" . $phpAds_config['tbl_adstats'] . " \tas s,\n\t\t\t\t\t\t" . $phpAds_config['tbl_banners'] . " \tas b,\n\t\t\t\t\t\t" . $phpAds_config['tbl_campaigns'] . " as m,\n\t\t\t\t\t\t" . $phpAds_config['tbl_clients'] . " \tas c\n\t\t\t\t\tWHERE\n\t\t\t\t\t\ts.bannerid \t\t= b.bannerid AND\n\t\t\t\t\t\tb.campaignid \t= m.campaignid AND\n\t\t\t\t\t\tm.clientid \t\t= c.clientid AND\n\t\t\t\t\t\tc.agencyid \t\t= " . phpAds_getUserID() . "\n\t\t\t\t\tGROUP BY\n\t\t\t\t\t\tday"; } $res_banners = phpAds_dbQuery($res_query) or phpAds_sqlDie(); while ($row_banners = phpAds_dbFetchArray($res_banners)) { $stats[$row_banners['day']]['views'] = $row_banners['adviews']; $stats[$row_banners['day']]['clicks'] = $row_banners['adclicks']; } echo $strGlobalHistory . "\n\n"; echo $strDay . $delimiter . $strViews . $delimiter . $strClicks . $delimiter . $strCTRShort . "\n"; $totalclicks = 0; $totalviews = 0; if (isset($stats) && is_array($stats)) { for (reset($stats); $key = key($stats); next($stats)) { $row = array(); //$key = implode('/',array_reverse(split('[-]',$key))); $row[] = $key; $row[] = $stats[$key]['views']; $row[] = $stats[$key]['clicks']; $row[] = phpAds_buildCTR($stats[$key]['views'], $stats[$key]['clicks']); echo implode($delimiter, $row) . "\n"; $totalclicks += $stats[$key]['clicks']; $totalviews += $stats[$key]['views']; } } echo "\n"; echo $strTotal . $delimiter . $totalviews . $delimiter . $totalclicks . $delimiter . phpAds_buildCTR($totalviews, $totalclicks) . "\n"; }
function phpAds_getZoneArray() { global $phpAds_config; if (phpAds_isUser(phpAds_Affiliate)) { $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t\tWHERE\n\t\t\t\taffiliateid = " . phpAds_getUserID() . "\n\t\t"); } else { $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t"); } while ($row = phpAds_dbFetchArray($res)) { $zoneArray[$row['zoneid']] = phpAds_buildClientName($row['zoneid'], $row['zonename']); } return $zoneArray; }
function phpAds_SettingsWriteFlush() { global $phpAds_config; global $phpAds_settings_information, $phpAds_settings_write_cache; $sql = array(); $config_inc = array(); while (list($k, $v) = each($phpAds_settings_write_cache)) { $k_sql = $phpAds_settings_information[$k]['sql']; $k_type = $phpAds_settings_information[$k]['type']; if ($k_sql) { if ($k_type == 'boolean') { $v = $v ? 't' : 'f'; } $sql[] = $k . " = '" . $v . "'"; } else { if ($k_type == 'boolean') { $v = $v ? true : false; } elseif ($k_type != 'array') { $v = stripslashes($v); } $config_inc[] = array($k, $v, $k_type); } } if (count($sql)) { if (phpAds_isUser(phpAds_Agency)) { $agencyid = phpAds_getUserID(); } else { $agencyid = 0; } $query = "UPDATE " . $phpAds_config['tbl_config'] . " SET " . join(", ", $sql) . " WHERE agencyid=" . $agencyid; $res = @phpAds_dbQuery($query); if (@phpAds_dbAffectedRows() < 1) { $query = "INSERT INTO " . $phpAds_config['tbl_config'] . " SET " . join(", ", $sql) . ",agencyid=" . $agencyid; @phpAds_dbQuery($query); } } if (count($config_inc)) { if (!phpAds_ConfigFilePrepare()) { return false; } while (list(, $v) = each($config_inc)) { phpAds_ConfigFileSet($v[0], $v[1], $v[2]); } return phpAds_ConfigFileFlush(); } return true; }
/* This program is free software. You can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ // Include required files require "config.php"; require "lib-statistics.inc.php"; // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Affiliate); /*********************************************************/ /* Affiliate interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Affiliate)) { $result = phpAds_dbQuery("\n\t\tSELECT\n\t\t\taffiliateid\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\tzoneid = '{$zoneid}'\n\t\t") or phpAds_sqlDie(); $row = phpAds_dbFetchArray($result); if ($row["affiliateid"] == '' || phpAds_getUserID() != $row["affiliateid"]) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ if ($phpAds_config['compact_stats']) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tWHERE\n\t\t\tzoneid = '{$zoneid}'\n\t\tGROUP BY\n\t\t\tday\n\t\tORDER BY\n\t\t\tday DESC\n\t\tLIMIT 7\n\t") or phpAds_sqlDie(); } else { $res = phpAds_dbQuery("\n\t\t SELECT\n\t\t\tDATE_FORMAT(t_stamp, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(t_stamp, '{$date_format}') as date_formatted\n\t\t FROM\n\t\t\t" . $phpAds_config['tbl_adviews'] . "\n\t\t WHERE\n\t\t\tzoneid = '{$zoneid}'\n\t\t GROUP BY\n\t\t\tdate\n\t\t ORDER BY\n\t\t\tdate DESC\n\t\t LIMIT 7\n\t") or phpAds_sqlDie(); } while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext($row['date_formatted'], "stats-zone-daily-hosts.php?day=" . $row['date'] . "&affiliateid=" . $affiliateid . "&zoneid=" . $zoneid, $day == $row['date']); }
require "config.php"; require "lib-statistics.inc.php"; // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Agency + phpAds_Affiliate); /*********************************************************/ /* Affiliate interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Affiliate)) { $query = "SELECT affiliateid" . " FROM " . $phpAds_config['tbl_zones'] . " WHERE zoneid=" . $zoneid . " AND affiliateid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT a.affiliateid AS affiliateid" . " FROM " . $phpAds_config['tbl_zones'] . " as z" . "," . $phpAds_config['tbl_affiliates'] . " as a" . " WHERE a.zoneid=z.zoneid" . " AND z.zoneid=" . $zoneid . " AND a.agencyid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ $res = phpAds_dbQuery("\n\tSELECT\n\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\tFROM\n\t\t" . $phpAds_config['tbl_adstats'] . "\n\tWHERE\n\t\tzoneid = '{$zoneid}'\n\tGROUP BY\n\t\tday\n\tORDER BY\n\t\tday DESC\n\tLIMIT 7\n") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext($row['date_formatted'], "stats-zone-daily-hosts.php?day=" . $row['date'] . "&affiliateid=" . $affiliateid . "&zoneid=" . $zoneid, $day == $row['date']); } if (phpAds_isUser(phpAds_Admin)) { phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif');
/* This program is free software. You can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ // Include required files require "config.php"; require "lib-statistics.inc.php"; // Register input variables phpAds_registerGlobal('period', 'start', 'limit', 'source'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Client); /*********************************************************/ /* Client interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Client)) { $clientid = phpAds_getUserID(); } /*********************************************************/ /* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin)) { if (isset($Session['prefs']['stats-global-client.php']['listorder'])) { $navorder = $Session['prefs']['stats-global-client.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['stats-global-client.php']['orderdirection'])) { $navdirection = $Session['prefs']['stats-global-client.php']['orderdirection']; } else { $navdirection = ''; }
require "lib-storage.inc.php"; require "lib-swf.inc.php"; require "lib-banner.inc.php"; require "lib-zones.inc.php"; // Register input variables phpAds_registerGlobal('convert', 'cancel', 'compress', 'convert_links', 'chosen_link', 'overwrite_link', 'overwrite_target', 'overwrite_source'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Client); /*********************************************************/ /* Client interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Client)) { if (phpAds_isAllowed(phpAds_ModifyBanner)) { $result = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tcampaignid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\tWHERE\n\t\t\t\tbannerid = '{$bannerid}'\n\t\t\t") or phpAds_sqlDie(); $row = phpAds_dbFetchArray($result); if ($row["campaignid"] == '' || phpAds_getUserID() != phpAds_getCampaignParentClientID($row["campaignid"])) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } else { $campaignid = $row["campaignid"]; } } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* Process submitted form */ /*********************************************************/ if (isset($convert)) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tbannerid = '{$bannerid}'\n\t") or phpAds_sqlDie();
phpAds_registerGlobal('value'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Client); /*********************************************************/ /* Main code */ /*********************************************************/ if ($value == "t") { $value = "f"; } else { $value = "t"; } if (phpAds_isUser(phpAds_Client)) { if ($value == 'f' && phpAds_isAllowed(phpAds_DisableBanner) || $value == 't' && phpAds_isAllowed(phpAds_ActivateBanner)) { $result = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tclientid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\tWHERE\n\t\t\t\tbannerid = '{$bannerid}'\n\t\t\t") or phpAds_sqlDie(); $row = phpAds_dbFetchArray($result); if ($row["clientid"] == '' || phpAds_getUserID() != phpAds_getParentID($row["clientid"])) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } else { $campaignid = $row["clientid"]; $res = phpAds_dbQuery("\n\t\t\t\tUPDATE\n\t\t\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t\t\tSET\n\t\t\t\t\tactive = '{$value}'\n\t\t\t\tWHERE\n\t\t\t\t\tbannerid = '{$bannerid}'\n\t\t\t\t") or phpAds_sqlDie(); // Rebuild priorities phpAds_PriorityCalculate(); // Rebuild cache if (!defined('LIBVIEWCACHE_INCLUDED')) { include phpAds_path . '/libraries/deliverycache/cache-' . $phpAds_config['delivery_caching'] . '.inc.php'; } phpAds_cacheDelete(); Header("Location: stats-campaign-banners.php?clientid=" . $clientid . "&campaignid=" . $campaignid); } } else {
/*********************************************************/ /* HTML framework */ /*********************************************************/ if (isset($Session['prefs']['stats-client-campaigns.php']['listorder'])) { $navorder = $Session['prefs']['stats-client-campaigns.php']['listorder']; } else { $navorder = ''; } if (isset($Session['prefs']['stats-client-campaigns.php']['orderdirection'])) { $navdirection = $Session['prefs']['stats-client-campaigns.php']['orderdirection']; } else { $navdirection = ''; } if (phpAds_isUser(phpAds_Client)) { if (phpAds_getUserID() == phpAds_getParentID($campaignid)) { $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\t\tWHERE\n\t\t\t\tparent = " . phpAds_getUserID() . "\n\t\t\t" . phpAds_getListOrder($navorder, $navdirection) . "\n\t\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildClientName($row['clientid'], $row['clientname']), "stats-campaign-target.php?clientid=" . $clientid . "&campaignid=" . $row['clientid'], $campaignid == $row['clientid']); } phpAds_PageHeader("1.2.3"); echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getClientName($campaignid) . "</b><br><br><br>"; phpAds_ShowSections(array("1.2.1", "1.2.2", "1.2.3")); } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } if (phpAds_isUser(phpAds_Admin)) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\t*\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_clients'] . "\n\t\tWHERE\n\t\t\tparent = " . $clientid . "\n\t\t" . phpAds_getListOrder($navorder, $navdirection) . "\n\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildClientName($row['clientid'], $row['clientname']), "stats-campaign-target.php?clientid=" . $clientid . "&campaignid=" . $row['clientid'], $campaignid == $row['clientid']);
phpAds_PageHeader("1.2.2.4"); echo "<img src='images/icon-campaign.gif' align='absmiddle'> " . phpAds_getCampaignName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-banner-stored.gif' align='absmiddle'> <b>" . phpAds_getBannerName($bannerid) . "</b><br><br>"; echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>"; phpAds_ShowSections($sections); } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid = " . $clientid . phpAds_getCampaignListOrder($navorder, $navdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . " AND agencyid=" . phpAds_getUserID() . phpAds_getCampaignListOrder($navorder, $navdirection); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "stats-banner-sources.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']); } phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif'); phpAds_PageShortcut($strCampaignProperties, 'campaign-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-campaign.gif'); phpAds_PageHeader("2.1.2.2.2"); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> " . phpAds_getParentClientName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> " . phpAds_getCampaignName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-banner-stored.gif' align='absmiddle'> <b>" . phpAds_getBannerName($bannerid) . "</b><br><br>"; echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>"; phpAds_ShowSections(array("2.1.2.2.1", "2.1.2.2.2"));
/* For more information visit: http://www.openads.org */ /* */ /* This program is free software. You can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ // Include required files require "config.php"; require "lib-statistics.inc.php"; // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Client); /*********************************************************/ /* Client interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Client)) { if (phpAds_getUserID() != phpAds_getParentID($campaignid)) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ $bannerids = array(); $idresult = phpAds_dbQuery("\n\tSELECT\n\t\tbannerid\n\tFROM\n\t\t" . $phpAds_config['tbl_banners'] . "\n\tWHERE\n\t\tclientid = '{$campaignid}'\n"); while ($row = phpAds_dbFetchArray($idresult)) { $bannerids[] = "bannerid = " . $row['bannerid']; } if ($phpAds_config['compact_stats']) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tWHERE\n\t\t\t(" . implode(' OR ', $bannerids) . ")\n\t\tGROUP BY\n\t\t\tday\n\t\tORDER BY\n\t\t\tday DESC\n\t\tLIMIT 7\n\t") or phpAds_sqlDie(); } else {
phpAds_registerGlobal('moveto', 'returnurl'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Agency); /*********************************************************/ /* Main code */ /*********************************************************/ if (isset($campaignid) && $campaignid != '') { if (isset($moveto) && $moveto != '') { if (phpAds_isUser(phpAds_Agency)) { $query = "SELECT c.clientid" . " FROM " . $phpAds_config['tbl_clients'] . " AS c" . "," . $phpAds_config['tbl_campaigns'] . " AS m" . " WHERE c.clientid=m.clientid" . " AND c.clientid=" . $clientid . " AND m.campaignid=" . $campaignid . " AND agencyid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } $query = "SELECT c.clientid" . " FROM " . $phpAds_config['tbl_clients'] . " AS c" . " WHERE c.clientid=" . $moveto . " AND agencyid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } // Delete any campaign-tracker links $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); // Move the campaign $res = phpAds_dbQuery("UPDATE " . $phpAds_config['tbl_campaigns'] . " SET clientid=" . $moveto . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); // Rebuild cache if (!defined('LIBVIEWCACHE_INCLUDED')) { include phpAds_path . '/libraries/deliverycache/cache-' . $phpAds_config['delivery_caching'] . '.inc.php'; } phpAds_cacheDelete();
/* For more information visit: http://www.phpadsnew.com */ /* */ /* This program is free software. You can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ // Include required files require "config.php"; require "lib-storage.inc.php"; require "lib-zones.inc.php"; // Register input variables phpAds_registerGlobal('duplicate', 'moveto', 'returnurl'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Agency); if (phpAds_isUser(phpAds_Agency)) { $res = phpAds_dbQuery("SELECT clientid" . " FROM " . $phpAds_config['tbl_clients'] . " AS c" . "," . $phpAds_config['tbl_trackers'] . " AS t" . " WHERE t.trackerid=c.trackterid" . " AND t.trackerid=" . $trackerid . " AND c.agencyid=" . phpAds_getUserID()) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* Main code */ /*********************************************************/ if (isset($trackerid) && $trackerid != '') { if (isset($moveto) && $moveto != '') { // Delete any campaign-tracker links $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie(); // Move the campaign $res = phpAds_dbQuery("UPDATE " . $phpAds_config['tbl_trackers'] . " SET clientid=" . $moveto . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie(); Header("Location: " . $returnurl . "?clientid=" . $moveto . "&trackerid=" . $trackerid);
function phpAds_checkIds() { global $clientid, $campaignid, $bannerid, $affiliateid, $zoneid, $userlogid, $day; // I also put it there to avoid problems during the check on client/affiliate interface if (phpAds_isUser(phpAds_Client)) { $clientid = phpAds_getUserID(); } elseif (phpAds_isUser(phpAds_Affiliate)) { $affiliateid = phpAds_getUserID(); } // Reset missing variables if (!isset($clientid)) { $clientid = ''; } if (!isset($campaignid)) { $campaignid = ''; } if (!isset($bannerid)) { $bannerid = ''; } if (!isset($affiliateid)) { $affiliateid = ''; } if (!isset($zoneid)) { $zoneid = ''; } if (!isset($userlogid)) { $userlogid = ''; } if (!isset($day)) { $day = ''; } $part = explode('-', str_replace('.php', '-', basename($_SERVER['SCRIPT_NAME']))); if ($stats = $part[0] == 'stats' ? 1 : 0) { array_shift($part); $redirects = array('client' => 'stats-global-client.php', 'campaign' => 'stats-client-campaigns.php', 'banner' => 'stats-campaign-banners.php', 'affiliate' => 'stats-global-affiliates.php', 'zone' => 'stats-affiliate-zones.php'); } else { $redirects = array('client' => 'client-index.php', 'campaign' => 'client-campaigns.php', 'banner' => 'campaign-banners.php', 'affiliate' => 'affiliate-index.php', 'zone' => 'affiliate-zones.php'); } // *-edit and *-index pages doesn't need ids when adding new item, lowering requirements if (isset($part[1]) && ($part[1] == 'edit' || $part[1] == 'index')) { if ($part[0] == 'client') { $part[0] = ''; } elseif ($part[0] == 'campaign') { $part[0] = 'client'; } elseif ($part[0] == 'banner') { $part[0] = 'campaign'; } elseif ($part[0] == 'affiliate') { $part[0] = ''; } elseif ($part[0] == 'zone') { $part[0] = 'affiliate'; } } switch ($part[0]) { case 'banner': if (!is_numeric($bannerid)) { if (is_numeric($clientid) && is_numeric($campaignid)) { // Banner-activate and banner-delete are also allowed to use only the campaign id if ($part[1] == 'activate' || $part[1] == 'delete') { break; } header('Location: ' . $redirects['banner'] . '?clientid=' . $clientid . '&campaignid=' . $campaignid); exit; } } elseif (isset($part[1]) && $part[1] == 'htmlpreview') { break; } case 'campaign': if (!is_numeric($campaignid)) { if (is_numeric($clientid)) { header('Location: ' . $redirects['campaign'] . '?clientid=' . $clientid); exit; } } case 'client': if (!is_numeric($clientid)) { header('Location: ' . $redirects['client']); exit; } break; case 'zone': case 'linkedbanners': if (!is_numeric($zoneid)) { if (is_numeric($affiliateid)) { header('Location: ' . $redirects['zone'] . '?affiliateid=' . $affiliateid); exit; } } case 'affiliate': if (!is_numeric($affiliateid)) { header('Location: ' . $redirects['affiliate']); exit; } break; } }
$query_banners = "SELECT bannerid, description ,alt, keyword, storagetype" . " FROM " . $phpAds_config['tbl_banners'] . " WHERE alt LIKE '%" . $keyword . "%'" . " OR description LIKE '%" . $keyword . "%'"; if ($phpAds_config['use_keywords']) { $query_banners .= " OR keyword LIKE '%" . $keyword . "%'"; } $query_affiliates = "SELECT affiliateid, name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE name LIKE '%" . $keyword . "%'"; $query_zones = "SELECT zoneid, zonename, description" . " FROM " . $phpAds_config['tbl_zones'] . " WHERE zonename LIKE '%" . $keyword . "%'" . " OR description LIKE '%" . $keyword . "%'"; } elseif (phpAds_isUser(phpAds_Agency)) { $query_clients = "SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE agencyid=" . phpAds_getUserID() . " AND clientname LIKE '%" . $keyword . "%'"; $query_campaigns = "SELECT m.campaignid as campaignid" . ",m.campaignname as campaignname" . ",m.clientid as clientid" . " FROM " . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE m.clientid=c.clientid" . " AND c.agencyid=" . phpAds_getUserID() . " AND m.campaignname LIKE '%" . $keyword . "%'"; $query_banners = "SELECT b.bannerid as bannerid" . ",b.description as description" . ",b.alt as alt" . ",b.keyword as keyword" . ",b.storagetype as storagetype" . ",b.campaignid as campaignid" . ",m.clientid as clientid" . " FROM " . $phpAds_config['tbl_banners'] . " AS b" . "," . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE m.clientid=c.clientid" . " AND b.campaignid=m.campaignid" . " AND c.agencyid=" . phpAds_getUserID() . " AND (b.alt LIKE '%" . $keyword . "%'" . " OR b.description LIKE '%" . $keyword . "%'"; if ($phpAds_config['use_keywords']) { $query_banners .= " OR b.keyword LIKE '%" . $keyword . "%'"; } $query_banners .= ")"; $query_affiliates = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE agencyid=" . phpAds_getUserID() . " AND name LIKE '%" . $keyword . "%'"; $query_zones = "SELECT zoneid as zoneid" . ", zonename as zonename" . ", description as description" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE a.affiliateid=z.affiliateid" . " AND a.agencyid=" . phpAds_getUserID() . " AND (z.zonename LIKE '%" . $keyword . "%'" . " OR z.description LIKE '%" . $keyword . "%')"; } $res_clients = phpAds_dbQuery($query_clients) or phpAds_sqlDie(); $res_campaigns = phpAds_dbQuery($query_campaigns) or phpAds_sqlDie(); $res_banners = phpAds_dbQuery($query_banners) or phpAds_sqlDie(); $res_affiliates = phpAds_dbQuery($query_affiliates) or phpAds_sqlDie(); $res_zones = phpAds_dbQuery($query_zones) or phpAds_sqlDie(); if (phpAds_dbNumRows($res_clients) > 0 || phpAds_dbNumRows($res_campaigns) > 0 || phpAds_dbNumRows($res_banners) > 0 || phpAds_dbNumRows($res_affiliates) > 0 || phpAds_dbNumRows($res_zones) > 0) { echo "<table width='100%' border='0' align='center' cellspacing='0' cellpadding='0'>"; echo "<tr height='25'>"; echo "<td height='25'><b> " . $GLOBALS['strName'] . "</b></td>"; echo "<td height='25'><b>" . $GLOBALS['strID'] . "</b> </td>"; echo "<td height='25'> </td>"; echo "<td height='25'> </td>"; echo "<td height='25'> </td>"; echo "</tr>";
// $Revision: 3830 $ /************************************************************************/ /* Openads 2.0 */ /* =========== */ /* */ /* Copyright (c) 2000-2007 by the Openads developers */ /* For more information visit: http://www.openads.org */ /* */ /* This program is free software. You can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ // Include required files require "config.php"; // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Client + phpAds_Affiliate); /*********************************************************/ /* Main code */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin)) { Header("Location: " . $phpAds_config['url_prefix'] . "/admin/client-index.php"); exit; } if (phpAds_isUser(phpAds_Client)) { Header("Location: " . $phpAds_config['url_prefix'] . "/admin/stats-client-history.php?clientid=" . phpAds_getUserID()); exit; } if (phpAds_isUser(phpAds_Affiliate)) { Header("Location: " . $phpAds_config['url_prefix'] . "/admin/stats-affiliate-zones.php?affiliateid=" . phpAds_getUserID()); exit; }
echo "</table>"; if ($zone['delivery'] == phpAds_ZoneBanner) { echo "<br><br><br>"; echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>"; echo "<tr><td height='25' colspan='3'><b>" . $strAppendSettings . "</b></td></tr>"; echo "<tr height='1'><td width='30'><img src='images/break.gif' height='1' width='30'></td>"; echo "<td width='200'><img src='images/break.gif' height='1' width='200'></td>"; echo "<td width='100%'><img src='images/break.gif' height='1' width='100%'></td></tr>"; echo "<tr><td height='10' colspan='3'> </td></tr>"; // Get available zones $available = array(); // Get list of public publishers if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT affiliateid" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE publiczones = 't'" . " OR affiliateid=" . $affiliateid; } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT affiliateid" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE (publiczones = 't'" . " OR affiliateid=" . $affiliateid . ")" . " AND agencyid=" . phpAds_getUserID(); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { $available[] = "affiliateid = '" . $row['affiliateid'] . "'"; } $available = implode($available, ' OR '); // Get list of zones to link to $res = phpAds_dbQuery("SELECT zoneid, zonename, delivery FROM " . $phpAds_config['tbl_zones'] . " WHERE " . "(delivery = " . phpAds_ZonePopup . " OR delivery = " . phpAds_ZoneInterstitial . ") AND (" . $available . ") ORDER BY zoneid"); $available = array(phpAds_ZonePopup => array(), phpAds_ZoneInterstitial => array()); while ($row = phpAds_dbFetchArray($res)) { $available[$row['delivery']][$row['zoneid']] = phpAds_buildZoneName($row['zoneid'], $row['zonename']); } // Determine appendtype if (isset($appendtype)) { $zone['appendtype'] = $appendtype;
if (isset($zoneid) && $zoneid > 0) { $result = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\taffiliateid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t\tWHERE\n\t\t\t\tzoneid = '{$zoneid}'\n\t\t\t") or phpAds_sqlDie(); $row = phpAds_dbFetchArray($result); if ($row["affiliateid"] == '' || phpAds_getUserID() != $row["affiliateid"]) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } else { $affiliateid = phpAds_getUserID(); } } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } elseif (phpAds_isUser(phpAds_Agency)) { if (isset($zoneid) && $zoneid > 0) { $result = phpAds_dbQuery("SELECT z.affiliateid AS affiliateid" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE zoneid='{$zoneid}'" . " AND a.affiliateid=z.affiliateid" . " AND a.agencyid=" . phpAds_getUserID()) or phpAds_sqlDie(); $row = phpAds_dbFetchArray($result); if ($row["affiliateid"] == '') { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tDISTINCT bannerid\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tWHERE\n\t\t\tzoneid=" . $zoneid . "\n\t") or phpAds_sqlDie();
$limit = " AND day >= " . date('Ymd', $timestamp); break; case 'm': $timestamp = mktime(0, 0, 0, date('m'), 1, date('Y')); $limit = " AND day >= " . date('Ymd', $timestamp); break; default: $limit = ''; $period = ''; break; } // Get the banners for each campaign if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT bannerid" . ",campaignid" . ",alt" . ",description" . ",active" . ",storagetype" . " FROM " . $phpAds_config['tbl_banners'] . phpAds_getBannerListOrder($listorder, $orderdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT b.bannerid AS bannerid" . ",b.campaignid AS campaignid" . ",b.alt AS alt" . ",b.description AS description" . ",b.active AS active" . ",b.storagetype AS storagetype" . " FROM " . $phpAds_config['tbl_banners'] . " AS b" . "," . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE b.campaignid=m.campaignid" . " AND m.clientid=c.clientid" . " AND c.agencyid=" . phpAds_getUserID() . phpAds_getBannerListOrder($listorder, $orderdirection); } $res_banners = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row_banners = phpAds_dbFetchArray($res_banners)) { if (isset($clients[$row_banners['campaignid']])) { $clients[$row_banners['campaignid']]['count']++; } if (isset($campaigns[$row_banners['campaignid']])) { $banners[$row_banners['bannerid']] = $row_banners; $banners[$row_banners['bannerid']]['clicks'] = 0; $banners[$row_banners['bannerid']]['views'] = 0; $campaigns[$row_banners['campaignid']]['count']++; } $res_stats = phpAds_dbQuery("SELECT" . " sum(views) as views" . ",sum(clicks) as clicks" . ",sum(conversions) as conversions" . " FROM " . $phpAds_config['tbl_adstats'] . " WHERE bannerid=" . $row_banners['bannerid'] . $limit) or phpAds_sqlDie(); if ($row_stats = phpAds_dbFetchArray($res_stats)) { $banners[$row_banners['bannerid']]['clicks'] = $row_stats['clicks'];
if (phpAds_isAllowed(phpAds_ModifyInfo)) { $query = "SELECT agencyid" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE affiliateid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if ($row = phpAds_dbFetchArray($res)) { $agencyid = $row['agencyid']; $affiliateid = phpAds_getUserID(); } else { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } elseif (phpAds_isUser(phpAds_Agency)) { $agencyid = phpAds_getUserID(); if (isset($affiliateid) && $affiliateid != '') { $query = "SELECT affiliateid" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE affiliateid=" . $affiliateid . " AND agencyid=" . $agencyid; $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } } else { $agencyid = 0; } /*********************************************************/ /* Process submitted form */ /*********************************************************/ if (isset($submit)) {
/* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ // Include required files require "config.php"; require "lib-statistics.inc.php"; // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Agency + phpAds_Affiliate); /*********************************************************/ /* Affiliate interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Affiliate)) { $affiliateid = phpAds_getUserID(); } elseif (phpAds_isUser(phpAds_Agency)) { if (isset($affiliateid) && $affiliateid != '') { $query = "SELECT affiliateid" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE affiliateid=" . $affiliateid . " AND agencyid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } } /*********************************************************/ /* HTML framework */ /*********************************************************/ $zoneids = array(); $idresult = phpAds_dbQuery("\n\tSELECT\n\t\tzoneid\n\tFROM\n\t\t" . $phpAds_config['tbl_zones'] . "\n\tWHERE\n\t\taffiliateid = '{$affiliateid}'\n"); while ($row = phpAds_dbFetchArray($idresult)) { $zoneids[] = "zoneid = " . $row['zoneid']; }
$query = "SELECT" . " z.zoneid as zoneid" . ",z.affiliateid as affiliateid" . ",z.zonename as zonename" . ",z.description as description" . ",z.width as width" . ",z.height as height" . ",z.what as what" . ",z.zonetype as zonetype" . ",z.delivery as delivery" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_banners'] . " AS b" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE a.affiliateid=z.affiliateid" . " AND a.agencyid=" . phpAds_getUserID() . " AND b.bannerid=" . $bannerid . " AND (z.width=b.width OR z.width=-1)" . " AND (z.height=b.height OR z.height=-1)" . " AND z.zonetype=" . phpAds_ZoneBanners . " AND z.delivery != " . phpAds_ZoneText . phpAds_getZoneListOrder($listorder, $orderdirection); } // Get banner zones $res = phpAds_dbQuery($query) or phpAds_sqlDie(); $zone_count = phpAds_dbNumRows($res); while ($row = phpAds_dbFetchArray($res)) { if (isset($affiliates[$row['affiliateid']])) { $row['linked'] = phpAds_IsBannerInZone($bannerid, $row['zoneid'], $row['what']); $affiliates[$row['affiliateid']]['zones'][$row['zoneid']] = $row; $affiliates[$row['affiliateid']]['ZoneBanners']++; } } if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT zoneid,affiliateid,zonename,description,width,height,what,zonetype,delivery" . " FROM " . $phpAds_config['tbl_zones'] . " WHERE zonetype=" . phpAds_ZoneCampaign . phpAds_getZoneListOrder($listorder, $orderdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT z.zoneid,z.affiliateid,z.zonename,z.description,z.width,z.height,z.what,z.zonetype,z.delivery" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE z.affiliateid=a.affiliateid" . " AND a.agencyid=" . phpAds_getUserID() . " AND z.zonetype=" . phpAds_ZoneCampaign . phpAds_getZoneListOrder($listorder, $orderdirection); } // Get campaign zones $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { if (isset($affiliates[$row['affiliateid']])) { if (phpAds_IsCampaignInZone($campaignid, $row['zoneid'], $row['what'])) { $zone_count++; $row['linked'] = true; $affiliates[$row['affiliateid']]['zones'][$row['zoneid']] = $row; $affiliates[$row['affiliateid']]['ZoneCampaigns']++; } } } } $tabindex = 1;
$query = "SELECT clientid" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE clientid=" . $clientid . " AND agencyid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } } /*********************************************************/ /* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . phpAds_getClientListOrder($navorder, $navdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE agencyid=" . phpAds_getUserID() . phpAds_getClientListOrder($navorder, $navdirection); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['clientid'], $row['clientname']), "stats-advertiser-history.php?clientid=" . $row['clientid'], $clientid == $row['clientid']); } phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif'); if (phpAds_isUser(phpAds_Admin)) { $extra = "<br><br><br>"; $extra .= "<b>{$strMaintenance}</b><br>"; $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>"; $extra .= "<a href='stats-reset.php?clientid={$clientid}'" . phpAds_DelConfirm($strConfirmResetClientStats) . ">"; $extra .= "<img src='images/" . $phpAds_TextDirection . "/icon-undo.gif' align='absmiddle' border='0'> {$strResetStats}</a>"; $extra .= "<br><br>"; } phpAds_PageHeader("2.1.1", $extra);
// Security check phpAds_checkAccess(phpAds_Admin + phpAds_Agency + phpAds_Client); /*********************************************************/ /* Client interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Client)) { $clientid = phpAds_getUserID(); $query = "SELECT campaignid" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . " AND campaignid=" . $campaignid; $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } elseif (phpAds_isUser(phpAds_Agency)) { $clientid = phpAds_getUserID(); $query = "SELECT campaignid" . " FROM " . $phpAds_config['tbl_campaigns'] . "," . $phpAds_config['tbl_clients'] . " WHERE clientid=" . $clientid . " AND campaignid=" . $campaignid . " AND agencyid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ $bannerids = array(); $idresult = phpAds_dbQuery("\n\tSELECT\n\t\tbannerid\n\tFROM\n\t\t" . $phpAds_config['tbl_banners'] . "\n\tWHERE\n\t\tcampaignid = '{$campaignid}'\n"); while ($row = phpAds_dbFetchArray($idresult)) { $bannerids[] = "bannerid = " . $row['bannerid']; } $res = phpAds_dbQuery("\n\tSELECT\n\t\tDATE_FORMAT(day, '%Y%m%d') as date,\n\t\tDATE_FORMAT(day, '{$date_format}') as date_formatted\n\tFROM\n\t\t" . $phpAds_config['tbl_adstats'] . "\n\tWHERE\n\t\t(" . implode(' OR ', $bannerids) . ")\n\tGROUP BY\n\t\tday\n\tORDER BY\n\t\tday DESC\n\tLIMIT 7\n") or phpAds_sqlDie();
require "config.php"; require "lib-statistics.inc.php"; require "lib-zones.inc.php"; require "lib-banner.inc.php"; // Include needed resources require phpAds_path . "/libraries/resources/res-iso639.inc.php"; require phpAds_path . "/libraries/resources/res-iso3166.inc.php"; require phpAds_path . "/libraries/resources/res-usstates.inc.php"; require phpAds_path . "/libraries/resources/res-useragent.inc.php"; require phpAds_path . "/libraries/resources/res-continent.inc.php"; // Register input variables phpAds_registerGlobal('submit', 'action', 'acl', 'type', 'time', 'cap', 'session_capping'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Agency); if (phpAds_isUser(phpAds_Agency)) { $query = "SELECT " . $phpAds_config['tbl_banners'] . ".bannerid as bannerid" . " FROM " . $phpAds_config['tbl_clients'] . "," . $phpAds_config['tbl_campaigns'] . "," . $phpAds_config['tbl_banners'] . " WHERE " . $phpAds_config['tbl_campaigns'] . ".clientid=" . $clientid . " AND " . $phpAds_config['tbl_banners'] . ".campaignid=" . $campaignid . " AND " . $phpAds_config['tbl_banners'] . ".bannerid=" . $bannerid . " AND " . $phpAds_config['tbl_banners'] . ".campaignid=" . $phpAds_config['tbl_campaigns'] . ".campaignid" . " AND " . $phpAds_config['tbl_campaigns'] . ".clientid=" . $phpAds_config['tbl_clients'] . ".clientid" . " AND " . $phpAds_config['tbl_clients'] . ".agencyid=" . phpAds_getUserID(); $res = phpAds_dbQuery($query) or phpAds_sqlDie(); if (phpAds_dbNumRows($res) == 0) { phpAds_PageHeader("2"); phpAds_Die($strAccessDenied, $strNotAdmin); } } // Define variable types $type_list['weekday'] = $strWeekDay; $type_list['time'] = $strTime; $type_list['date'] = $strDate; $type_list['clientip'] = $strClientIP; $type_list['domain'] = $strDomain; $type_list['language'] = $strLanguage; // Get geotargeting info if ($phpAds_config['geotracking_type'] != '') {
/************************************************************************/ // Include required files require "config.php"; require "lib-statistics.inc.php"; require "lib-zones.inc.php"; // Register input variables phpAds_registerGlobal('action', 'zonetype', 'what', 'submit', 'showbanners', 'showcampaigns', 'hideinactive'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Affiliate); /*********************************************************/ /* Affiliate interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Affiliate)) { $result = phpAds_dbQuery("\n\t\tSELECT\n\t\t\taffiliateid\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\tzoneid = '{$zoneid}'\n\t\t") or phpAds_sqlDie(); $row = phpAds_dbFetchArray($result); if ($row["affiliateid"] == '' || phpAds_getUserID() != $row["affiliateid"] || !phpAds_isAllowed(phpAds_LinkBanners)) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } else { $affiliateid = $row["affiliateid"]; } } /*********************************************************/ /* Process submitted form */ /*********************************************************/ if (isset($zoneid) && $zoneid != '') { if (isset($action) && $action == 'toggle') { // Update zonetype $result = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\t*\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t\tWHERE\n\t\t\t\tzoneid = '" . $zoneid . "'\n\t\t") or phpAds_sqlDie(); if ($row = phpAds_dbFetchArray($result)) { if ($row['zonetype'] != $zonetype) {
// Register input variables phpAds_registerGlobal('period', 'start', 'limit', 'source'); // Security check phpAds_checkAccess(phpAds_Admin + phpAds_Affiliate); /*********************************************************/ /* Affiliate interface security */ /*********************************************************/ if (phpAds_isUser(phpAds_Affiliate)) { if (isset($zoneid) && $zoneid > 0) { $result = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\taffiliateid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t\tWHERE\n\t\t\t\tzoneid = '{$zoneid}'\n\t\t\t") or phpAds_sqlDie(); $row = phpAds_dbFetchArray($result); if ($row["affiliateid"] == '' || phpAds_getUserID() != $row["affiliateid"]) { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } else { $affiliateid = phpAds_getUserID(); } } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } /*********************************************************/ /* HTML framework */ /*********************************************************/ if (phpAds_isUser(phpAds_Admin)) { if ($phpAds_config['compact_stats']) { $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tDISTINCT bannerid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\t\tWHERE\n\t\t\t\tzoneid = '" . $zoneid . "'\n\t\t") or phpAds_sqlDie(); } else { $res = phpAds_dbQuery("\n\t\t\tSELECT\n\t\t\t\tDISTINCT bannerid\n\t\t\tFROM\n\t\t\t\t" . $phpAds_config['tbl_adviews'] . "\n\t\t\tWHERE\n\t\t\t\tzoneid = '" . $zoneid . "'\n\t\t") or phpAds_sqlDie(); }
} $res_zones = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row_zones = phpAds_dbFetchArray($res_zones)) { if (isset($affiliates[$row_zones['affiliateid']])) { $zones[$row_zones['zoneid']] = $row_zones; $affiliates[$row_zones['affiliateid']]['count']++; $zones[$row_zones['zoneid']]['views'] = 0; $zones[$row_zones['zoneid']]['clicks'] = 0; } } // Get the adviews/clicks for each banner if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT zoneid,sum(views) as views,sum(clicks) as clicks" . " FROM " . $phpAds_config['tbl_adstats'] . " GROUP BY zoneid"; } if (phpAds_isUser(phpAds_Agency)) { $query = "SELECT s.zoneid as zoneid,sum(s.views) as views,sum(s.clicks) as clicks" . " FROM " . $phpAds_config['tbl_adstats'] . " AS s" . "," . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE s.zoneid=z.zoneid" . " AND z.affiliateid=a.affiliateid" . " AND a.agencyid=" . phpAds_getUserID() . " GROUP BY zoneid"; } $res_stats = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row_stats = phpAds_dbFetchArray($res_stats)) { if (isset($zones[$row_stats['zoneid']])) { $zones[$row_stats['zoneid']]['clicks'] = $row_stats['clicks']; $zones[$row_stats['zoneid']]['views'] = $row_stats['views']; } } // Add ID found in expand to expanded nodes if (isset($expand) && $expand != '') { switch ($expand) { case 'all': $node_array = array(); if (isset($affiliates)) { for (reset($affiliates); $key = key($affiliates); next($affiliates)) {
phpAds_PageShortcut($strCampaignHistory, 'stats-campaign-history.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-statistics.gif'); $extra = "\t\t\t\t<form action='campaign-modify.php'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='campaignid' value='{$campaignid}'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='clientid' value='{$clientid}'>" . "\n"; $extra .= "\t\t\t\t<input type='hidden' name='returnurl' value='campaign-trackers.php'>" . "\n"; $extra .= "\t\t\t\t<br><br>" . "\n"; $extra .= "\t\t\t\t<b>{$strModifyCampaign}</b><br>" . "\n"; $extra .= "\t\t\t\t<img src='images/break.gif' height='1' width='160' vspace='4'><br>" . "\n"; $extra .= "\t\t\t\t<img src='images/icon-move-campaign.gif' align='absmiddle'> {$strMoveTo}<br>" . "\n"; $extra .= "\t\t\t\t<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>" . "\n"; $extra .= "\t\t\t\t " . "\n"; $extra .= "\t\t\t\t<select name='moveto' style='width: 110;'>" . "\n"; if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE clientid!=" . $clientid; } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE clientid!=" . $clientid . " AND agencyid=" . phpAds_getUserID(); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { $extra .= "\t\t\t\t\t<option value='" . $row['clientid'] . "'>" . phpAds_buildName($row['clientid'], $row['clientname']) . "</option>\n"; } $extra .= "\t\t\t\t</select> \n"; $extra .= "\t\t\t\t<input type='image' src='images/" . $phpAds_TextDirection . "/go_blue.gif'><br>\n"; $extra .= "\t\t\t\t<img src='images/break.gif' height='1' width='160' vspace='4'><br>\n"; $extra .= "\t\t\t\t<img src='images/icon-recycle.gif' align='absmiddle'>\n"; $extra .= "\t\t\t\t<a href='campaign-delete.php?clientid={$clientid}&campaignid={$campaignid}&returnurl=advertiser-campaigns.php'" . phpAds_DelConfirm($strConfirmDeleteTracker) . ">{$strDelete}</a><br>\n"; $extra .= "\t\t\t\t</form>\n"; phpAds_PageHeader("4.1.3.5", $extra); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> " . phpAds_getParentClientName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>";
while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "stats-campaign-target.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']); } phpAds_PageHeader("1.2.4"); echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>"; phpAds_ShowSections(array("1.2.1", "1.2.2", "1.2.3", "1.2.4")); } else { phpAds_PageHeader("1"); phpAds_Die($strAccessDenied, $strNotAdmin); } } if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) { if (phpAds_isUser(phpAds_Admin)) { $query = "SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . phpAds_getCampaignListOrder($navorder, $navdirection); } elseif (phpAds_isUser(phpAds_Agency)) { $query = "SELECT m.campaignid,m.campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE m.clientid=c.clientid" . " AND m.clientid=" . $clientid . " AND c.agencyid=" . phpAds_getUserID() . phpAds_getCampaignListOrder($navorder, $navdirection); } $res = phpAds_dbQuery($query) or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res)) { phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "stats-campaign-target.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']); } phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif'); phpAds_PageShortcut($strCampaignProperties, 'campaign-edit.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-campaign.gif'); phpAds_PageHeader("2.1.2.4"); echo "<img src='images/icon-advertiser.gif' align='absmiddle'> " . phpAds_getParentClientName($campaignid); echo " <img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'> "; echo "<img src='images/icon-campaign.gif' align='absmiddle'> <b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>"; phpAds_ShowSections(array("2.1.2.1", "2.1.2.2", "2.1.2.3", "2.1.2.4", "2.1.2.5")); } /*********************************************************/ /* Main code */