function phpAds_DeleteBanner($bannerid) { global $phpAds_config; // Cleanup webserver stored image $res = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tstoragetype, filename\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tbannerid = '{$bannerid}'\n\t") or phpAds_sqlDie(); if ($row = phpAds_dbFetchArray($res)) { if (($row['storagetype'] == 'web' || $row['storagetype'] == 'sql') && $row['filename'] != '') { phpAds_ImageDelete($row['storagetype'], $row['filename']); } } // Delete banner $res = phpAds_dbQuery("\n\t\tDELETE FROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tbannerid = '{$bannerid}'\n\t\t") or phpAds_sqlDie(); // Delete banner ACLs $res = phpAds_dbQuery("\n\t\tDELETE FROM\n\t\t\t" . $phpAds_config['tbl_acls'] . "\n\t\tWHERE\n\t\t\tbannerid = '{$bannerid}'\n\t\t") or phpAds_sqlDie(); // Delete statistics for this banner phpAds_deleteStatsByBannerID($bannerid); }
function phpAds_DeleteCampaign($campaignid) { global $phpAds_config; // Delete Campaign $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); // Delete Campaign/Tracker links $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); // Delete Conversions Logged to this Campaign $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_conversionlog'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); // Loop through each banner $res_banners = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tbannerid,\n\t\t\tstoragetype,\n\t\t\tfilename\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tcampaignid = '{$campaignid}'\n\t") or phpAds_sqlDie(); while ($row = phpAds_dbFetchArray($res_banners)) { // Cleanup stored images for each banner if (($row['storagetype'] == 'web' || $row['storagetype'] == 'sql') && $row['filename'] != '') { phpAds_ImageDelete($row['storagetype'], $row['filename']); } // Delete Banner ACLs phpAds_dbQuery("\n\t\t\tDELETE FROM\n\t\t\t\t" . $phpAds_config['tbl_acls'] . "\n\t\t\tWHERE\n\t\t\t\tbannerid = " . $row['bannerid'] . "\n\t\t") or phpAds_sqlDie(); // Delete stats for each banner phpAds_deleteStatsByBannerID($row['bannerid']); } // Delete Banners phpAds_dbQuery("\n\t\tDELETE FROM\n\t\t\t" . $phpAds_config['tbl_banners'] . "\n\t\tWHERE\n\t\t\tcampaignid = '{$campaignid}'\n\t") or phpAds_sqlDie(); }
// Delete Campaign/Tracker links $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); // Delete Conversions Logged to this Campaign $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_conversionlog'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); // Loop through each banner $res_banners = phpAds_dbQuery("SELECT" . " bannerid" . ",storagetype" . ",filename" . " FROM " . $phpAds_config['tbl_banners'] . " WHERE campaignid=" . $row_campaign['campaignid'] . "\n\t\t\t") or phpAds_sqlDie(); while ($row_banners = phpAds_dbFetchArray($res_banners)) { $bannerid = $row_banners['bannerid']; // Cleanup stored images for each banner if (($row_banners['storagetype'] == 'web' || $row_banners['storagetype'] == 'sql') && $row_banners['filename'] != '') { phpAds_ImageDelete($row_banners['storagetype'], $row_banners['filename']); } // Delete Banner ACLs phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_acls'] . " WHERE bannerid=" . $bannerid) or phpAds_sqlDie(); // Delete stats for each banner phpAds_deleteStatsByBannerID($bannerid); } // Delete Banners phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_banners'] . " WHERE campaignid=" . $campaignid) or phpAds_sqlDie(); } // Loop through each tracker $res_tracker = phpAds_dbQuery("SELECT trackerid" . " FROM " . $phpAds_config['tbl_trackers'] . " WHERE clientid=" . $clientid) or phpAds_sqlDie(); while ($row_tracker = phpAds_dbFetchArray($res_tracker)) { $trackerid = $row_tracker['trackerid']; // Delete Campaign/Tracker links $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie(); // Delete stats for each tracker phpAds_deleteStatsByTrackerID($trackerid); } // Delete Clients $res = phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_clients'] . " WHERE clientid=" . $clientid) or phpAds_sqlDie();
// Delete stats for this banner phpAds_deleteStatsByBannerID($bannerid); // Return to campaign statistics Header("Location: stats-campaign-banners.php?clientid=" . $clientid . "&campaignid=" . $campaignid); } elseif (isset($campaignid) && $campaignid != '') { // Get all banners for this client $idresult = phpAds_dbQuery(" SELECT\n\t\t\t\t\t\t\t\tbannerid\n\t\t\t\t\t\t\t FROM\n\t\t\t\t\t\t\t \t" . $phpAds_config['tbl_banners'] . "\n\t\t\t\t\t\t\t WHERE\n\t\t\t\t\t\t\t\tcampaignid = '{$campaignid}'\n\t\t \t\t\t\t "); // Loop to all banners for this client while ($row = phpAds_dbFetchArray($idresult)) { // Delete stats for the banner phpAds_deleteStatsByBannerID($row['bannerid']); } // Return to campaign statistics Header("Location: stats-advertiser-campaigns.php?clientid=" . $clientid); } elseif (isset($clientid) && $clientid != '') { // Get all banners for this client $idresult = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tb.bannerid\n\t\tFROM\n\t\t\t" . $phpAds_config['tbl_banners'] . " AS b,\n\t\t\t" . $phpAds_config['tbl_campaigns'] . " AS c\n\t\tWHERE\n\t\t\tc.clientid = {$clientid} AND\n\t\t\tc.campaignid = b.campaignid\n\t"); // Loop to all banners for this client while ($row = phpAds_dbFetchArray($idresult)) { // Delete stats for the banner phpAds_deleteStatsByBannerID($row['bannerid']); } // Return to campaign statistics Header("Location: stats-global-advertiser.php"); } elseif (isset($all) && $all == 'tr' . 'ue') { phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_adviews']) or phpAds_sqlDie(); phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_adclicks']) or phpAds_sqlDie(); phpAds_dbQuery("DELETE FROM " . $phpAds_config['tbl_adstats']) or phpAds_sqlDie(); // Return to campaign statistics Header("Location: stats-global-advertiser.php"); }