echo phpAds_buildBannerCode($bannerid) . "<br><br><br><br>";
phpAds_ShowSections(array("2.1.2.2.1", "2.1.2.2.2"));
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$manual['clicks'] = 0;
$manual['views'] = 0;
// Get affiliates and build the tree
$res_affiliates = phpAds_dbQuery("\n\tSELECT \n\t\taffiliateid, name\n\tFROM \n\t\t" . $phpAds_config['tbl_affiliates'] . "\n\t" . phpAds_getAffiliateListOrder($listorder, $orderdirection) . "\n\t") or phpAds_sqlDie();
while ($row_affiliates = phpAds_dbFetchArray($res_affiliates)) {
    $affiliates[$row_affiliates['affiliateid']] = $row_affiliates;
    $affiliates[$row_affiliates['affiliateid']]['expand'] = 0;
    $affiliates[$row_affiliates['affiliateid']]['count'] = 0;
}
// Get the zones for each affiliate
$res_zones = phpAds_dbQuery("\n\tSELECT \n\t\tzoneid, affiliateid, zonename, delivery, what\n\tFROM \n\t\t" . $phpAds_config['tbl_zones'] . "\n\t\t" . phpAds_getZoneListOrder($listorder, $orderdirection) . "\n\t") 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_config['compact_stats']) {
    $res_stats = phpAds_dbQuery("\n\t\tSELECT\n\t\t\tzoneid,\n\t\t\tsum(views) as views,\n\t\t\tsum(clicks) as clicks\n\t\tFROM \n\t\t\t" . $phpAds_config['tbl_adstats'] . "\n\t\tWHERE\n\t\t\tbannerid = '" . $bannerid . "'\n\t\tGROUP BY\n\t\t\tzoneid\n\t\t") 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'];
}
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
if (isset($Session['prefs']['affiliate-zones.php']['listorder'])) {
    $navorder = $Session['prefs']['affiliate-zones.php']['listorder'];
} else {
    $navorder = '';
}
if (isset($Session['prefs']['affiliate-zones.php']['orderdirection'])) {
    $navdirection = $Session['prefs']['affiliate-zones.php']['orderdirection'];
} else {
    $navdirection = '';
}
// Get other zones
$res = phpAds_dbQuery("\n\tSELECT\n\t\t*\n\tFROM\n\t\t" . $phpAds_config['tbl_zones'] . "\n\tWHERE\n\t\taffiliateid=" . $affiliateid . "\n\t\t" . phpAds_getZoneListOrder($navorder, $navdirection) . "\n");
while ($row = phpAds_dbFetchArray($res)) {
    phpAds_PageContext(phpAds_buildZoneName($row['zoneid'], $row['zonename']), "zone-advanced.php?affiliateid=" . $affiliateid . "&zoneid=" . $row['zoneid'], $zoneid == $row['zoneid']);
}
if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) {
    phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif');
    phpAds_PageShortcut($strZoneHistory, 'stats-zone-history.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-statistics.gif');
    $extra = "<form action='zone-modify.php'>";
    $extra .= "<input type='hidden' name='zoneid' value='{$zoneid}'>";
    $extra .= "<input type='hidden' name='returnurl' value='zone-advanced.php'>";
    $extra .= "<br><br>";
    $extra .= "<b>{$strModifyZone}</b><br>";
    $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
    $extra .= "<img src='images/icon-duplicate-zone.gif' align='absmiddle'>&nbsp;<a href='zone-modify.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&duplicate=true&returnurl=zone-advanced.php'>{$strDuplicate}</a><br>";
    $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
    $extra .= "<img src='images/icon-move-zone.gif' align='absmiddle'>&nbsp;{$strMoveTo}<br>";
    echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getAffiliateName($affiliateid) . "</b><br><br><br>";
    phpAds_ShowSections(array("4.2.2", "4.2.3"));
} else {
    $sections[] = "2.1";
    if (phpAds_isAllowed(phpAds_ModifyInfo)) {
        $sections[] = "2.2";
    }
    phpAds_PageHeader("2.1");
    echo "<img src='images/icon-affiliate.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getAffiliateName($affiliateid) . "</b><br><br><br>";
    phpAds_ShowSections($sections);
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
// Get clients & campaign and build the tree
$res_zones = phpAds_dbQuery("\n\t\tSELECT \n\t\t\t*\n\t\tFROM \n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\taffiliateid = '" . $affiliateid . "'\n\t\t" . phpAds_getZoneListOrder($listorder, $orderdirection) . "\n\t\t") or phpAds_sqlDie();
if (phpAds_isUser(phpAds_Admin) || phpAds_isAllowed(phpAds_AddZone)) {
    echo "<img src='images/icon-zone-new.gif' border='0' align='absmiddle'>&nbsp;";
    echo "<a href='zone-edit.php?affiliateid=" . $affiliateid . "' accesskey='" . $keyAddNew . "'>" . $strAddNewZone_Key . "</a>&nbsp;&nbsp;";
    phpAds_ShowBreak();
}
echo "<br><br>";
echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
echo "<tr height='25'>";
echo '<td height="25"><b>&nbsp;&nbsp;<a href="affiliate-zones.php?affiliateid=' . $affiliateid . '&listorder=name">' . $GLOBALS['strName'] . '</a>';
if ($listorder == "name" || $listorder == "") {
    if ($orderdirection == "" || $orderdirection == "down") {
        echo ' <a href="affiliate-zones.php?affiliateid=' . $affiliateid . '&orderdirection=up">';
        echo '<img src="images/caret-ds.gif" border="0" alt="" title="">';
    } else {
        echo ' <a href="affiliate-zones.php?affiliateid=' . $affiliateid . '&orderdirection=down">';
} elseif (phpAds_isUser(phpAds_Affiliate)) {
    $query = "SELECT * FROM " . $phpAds_config['tbl_affiliates'] . " WHERE affiliateid=" . $Session['userid'] . phpAds_getAffiliateListOrder($listorder, $orderdirection);
}
$res_affiliates = phpAds_dbQuery($query) or phpAds_sqlDie();
while ($row_affiliates = phpAds_dbFetchArray($res_affiliates)) {
    $affiliates[$row_affiliates['affiliateid']] = $row_affiliates;
    $affiliates[$row_affiliates['affiliateid']]['expand'] = 0;
    $affiliates[$row_affiliates['affiliateid']]['count'] = 0;
}
// Get the zones for each affiliate
if (phpAds_isUser(phpAds_Admin)) {
    $query = "SELECT zoneid,zonename,affiliateid,delivery,what" . " FROM " . $phpAds_config['tbl_zones'] . phpAds_getZoneListOrder($listorder, $orderdirection);
} elseif (phpAds_isUser(phpAds_Agency)) {
    $query = "SELECT " . $phpAds_config['tbl_zones'] . ".zoneid as zoneid" . "," . $phpAds_config['tbl_zones'] . ".zonename as zonename" . "," . $phpAds_config['tbl_zones'] . ".affiliateid as affiliateid" . "," . $phpAds_config['tbl_zones'] . ".delivery as delivery" . "," . $phpAds_config['tbl_zones'] . ".what as what" . " FROM " . $phpAds_config['tbl_zones'] . "," . $phpAds_config['tbl_affiliates'] . " WHERE agencyid=" . $Session['userid'] . " AND " . $phpAds_config['tbl_affiliates'] . ".affiliateid=" . $phpAds_config['tbl_zones'] . ".affiliateid" . phpAds_getZoneListOrder($listorder, $orderdirection);
} elseif (phpAds_isUser(phpAds_Affiliate)) {
    $query = "SELECT zoneid,zonename,affiliateid,delivery,what" . " FROM " . $phpAds_config['tbl_zones'] . " WHERE affiliateid=" . $Session['userid'] . phpAds_getZoneListOrder($listorder, $orderdirection);
}
$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']++;
    } else {
        $loosezones = true;
    }
}
// Add ID found in expand to expanded nodes
if (isset($expand) && $expand != '') {
    switch ($expand) {
        case 'all':
            $node_array = array();
示例#5
0
        $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;
            }
        }
    }
} else {
    // Get banner zones
    $res = phpAds_dbQuery("\n\t\tSELECT \n\t\t\tz.zoneid as zoneid,\n\t\t\tz.affiliateid as affiliateid,\n\t\t\tz.zonename as zonename,\n\t\t\tz.description as description,\n\t\t\tz.width as width,\n\t\t\tz.height as height,\n\t\t\tz.what as what,\n\t\t\tz.zonetype as zonetype,\n\t\t\tz.delivery as delivery\n\t\tFROM \n\t\t\t" . $phpAds_config['tbl_zones'] . " AS z,\n\t\t\t" . $phpAds_config['tbl_banners'] . " AS b\n\t\tWHERE\n\t\t\tb.bannerid = {$bannerid} AND\n\t\t\t(z.width = b.width OR z.width = -1) AND\n\t\t\t(z.height = b.height OR z.height = -1) AND\n\t\t\tz.zonetype = " . phpAds_ZoneBanners . " AND\n\t\t\tz.delivery != " . phpAds_ZoneText . "\n\t\t" . phpAds_getZoneListOrder($listorder, $orderdirection) . "\n\t") 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']++;
        }
    }
    // Get campaign zones
    $res = phpAds_dbQuery("\n\t\tSELECT \n\t\t\tzoneid,\n\t\t\taffiliateid,\n\t\t\tzonename,\n\t\t\tdescription,\n\t\t\twidth,\n\t\t\theight,\n\t\t\twhat,\n\t\t\tzonetype,\n\t\t\tdelivery\n\t\tFROM \n\t\t\t" . $phpAds_config['tbl_zones'] . "\n\t\tWHERE\n\t\t\tzonetype = " . phpAds_ZoneCampaign . "\n\t\t" . phpAds_getZoneListOrder($listorder, $orderdirection) . "\n\t") 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;
echo "<br><table border='0' width='100%' cellpadding='0' cellspacing='0'>";
echo "<form name='zones' action='banner-zone.php' method='post'>";
echo "<input type='hidden' name='clientid' value='" . $clientid . "'>";
if (phpAds_isUser(phpAds_Admin)) {
    $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . phpAds_getAffiliateListOrder($listorder, $orderdirection);
} elseif (phpAds_isUser(phpAds_Agency)) {
    $query = "SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE agencyid=" . phpAds_getUserID() . phpAds_getAffiliateListOrder($listorder, $orderdirection);
}
$res_affiliates = phpAds_dbQuery($query) or phpAds_sqlDie();
while ($row_affiliates = phpAds_dbFetchArray($res_affiliates)) {
    $affiliates[$row_affiliates['affiliateid']] = $row_affiliates;
    $affiliates[$row_affiliates['affiliateid']]['expand'] = 0;
    $affiliates[$row_affiliates['affiliateid']]['count'] = 0;
}
// Get the zones for each affiliate
if (phpAds_isUser(phpAds_Admin)) {
    $query = "SELECT zoneid,affiliateid,zonename,delivery" . " FROM " . $phpAds_config['tbl_zones'] . phpAds_getZoneListOrder($listorder, $orderdirection);
} elseif (phpAds_isUser(phpAds_Agency)) {
    $query = "SELECT z.zoneid as zoneid,z.affiliateid as affiliateid,z.zonename as zonename,z.delivery as delivery" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE z.affiliateid=a.affiliateid" . phpAds_getZoneListOrder($listorder, $orderdirection);
}
$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)) {
} elseif (phpAds_isUser(phpAds_Client)) {
    $query = "SELECT affiliateid" . ",name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE agencyid=" . phpAds_getAgencyID() . phpAds_getAffiliateListOrder($listorder, $orderdirection);
}
$res_affiliates = phpAds_dbQuery($query) or phpAds_sqlDie();
while ($row_affiliates = phpAds_dbFetchArray($res_affiliates)) {
    $affiliates[$row_affiliates['affiliateid']] = $row_affiliates;
    $affiliates[$row_affiliates['affiliateid']]['expand'] = 0;
    $affiliates[$row_affiliates['affiliateid']]['count'] = 0;
}
// Get the zones for each affiliate
if (phpAds_isUser(phpAds_Admin)) {
    $query = "SELECT zoneid" . ",affiliateid" . ",zonename" . ",delivery" . ",what" . " FROM " . $phpAds_config['tbl_zones'] . phpAds_getZoneListOrder($listorder, $orderdirection);
} elseif (phpAds_isUser(phpAds_Agency)) {
    $query = "SELECT z.zoneid AS zoneid" . ",z.affiliateid AS affiliateid" . ",z.zonename AS zonename" . ",z.delivery AS delivery" . ",z.what AS what" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE z.affiliateid=a.affiliateid" . " AND a.agencyid=" . phpAds_getAgencyID() . phpAds_getZoneListOrder($listorder, $orderdirection);
} elseif (phpAds_isUser(phpAds_Client)) {
    $query = "SELECT z.zoneid AS zoneid" . ",z.affiliateid AS affiliateid" . ",z.zonename AS zonename" . ",z.delivery AS delivery" . ",z.what AS what" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE z.affiliateid=a.affiliateid" . " AND a.agencyid=" . phpAds_getAgencyID() . phpAds_getZoneListOrder($listorder, $orderdirection);
}
$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']]['clicks'] = 0;
        $zones[$row_zones['zoneid']]['conversions'] = 0;
        $zones[$row_zones['zoneid']]['views'] = 0;
    }
}
// Check to see if this campaign is anonymous
$anonymous = false;
$res_campaign = phpAds_dbQuery("SELECT anonymous" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE campaignid=" . $campaignid);
if ($row_campaign = phpAds_dbFetchArray($res_campaign)) {
}
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
if (isset($Session['prefs']['affiliate-zones.php']['listorder'])) {
    $navorder = $Session['prefs']['affiliate-zones.php']['listorder'];
} else {
    $navorder = '';
}
if (isset($Session['prefs']['affiliate-zones.php']['orderdirection'])) {
    $navdirection = $Session['prefs']['affiliate-zones.php']['orderdirection'];
} else {
    $navdirection = '';
}
// Get other zones
$res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_zones'] . " WHERE affiliateid=" . $affiliateid . phpAds_getZoneListOrder($navorder, $navdirection));
while ($row = phpAds_dbFetchArray($res)) {
    phpAds_PageContext(phpAds_buildZoneName($row['zoneid'], $row['zonename']), "zone-include.php?affiliateid=" . $affiliateid . "&zoneid=" . $row['zoneid'], $zoneid == $row['zoneid']);
}
if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) {
    phpAds_PageShortcut($strAffiliateProperties, 'affiliate-edit.php?affiliateid=' . $affiliateid, 'images/icon-affiliate.gif');
    phpAds_PageShortcut($strZoneHistory, 'stats-zone-history.php?affiliateid=' . $affiliateid . '&zoneid=' . $zoneid, 'images/icon-statistics.gif');
    $extra = "<form action='zone-modify.php'>" . "\n";
    $extra .= "<input type='hidden' name='zoneid' value='{$zoneid}'>" . "\n";
    $extra .= "<input type='hidden' name='affiliateid' value='{$affiliateid}'>" . "\n";
    $extra .= "<input type='hidden' name='returnurl' value='zone-include.php'>" . "\n";
    $extra .= "<br><br>" . "\n";
    $extra .= "<b>{$strModifyZone}</b><br>" . "\n";
    $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>" . "\n";
    $extra .= "<img src='images/icon-duplicate-zone.gif' align='absmiddle'>&nbsp;<a href='zone-modify.php?affiliateid=" . $affiliateid . "&zoneid=" . $zoneid . "&duplicate=true&returnurl=zone-include.php'>{$strDuplicate}</a><br>" . "\n";
    $extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>" . "\n";
示例#10
0
$extra .= "<img src='images/icon-recycle.gif' align='absmiddle'>&nbsp;<a href='campaign-delete.php?clientid=" . $clientid . "&campaignid=" . $campaignid . "&returnurl=advertiser-index.php'" . phpAds_DelConfirm($strConfirmDeleteCampaign) . ">{$strDelete}</a><br>";
$extra .= "</form>";
phpAds_PageHeader("4.1.3.4", $extra);
echo "<img src='images/icon-advertiser.gif' align='absmiddle'>&nbsp;" . phpAds_getParentClientName($campaignid);
echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;<b>" . phpAds_getCampaignName($campaignid) . "</b><br><br><br>";
phpAds_ShowSections(array("4.1.3.2", "4.1.3.3", "4.1.3.4", "4.1.3.5"));
/*********************************************************/
/* Main code                                             */
/*********************************************************/
$res = phpAds_dbQuery("SELECT affiliateid,name" . " FROM " . $phpAds_config['tbl_affiliates'] . " WHERE agencyid=" . $agencyid . phpAds_getAffiliateListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
$affiliate_count = phpAds_dbNumRows($res);
while ($row = phpAds_dbFetchArray($res)) {
    $affiliates[$row['affiliateid']] = $row;
}
$res = phpAds_dbQuery("SELECT z.zoneid,z.affiliateid,z.zonename,z.description,z.width,z.height,z.what,z.delivery" . " FROM " . $phpAds_config['tbl_zones'] . " AS z" . "," . $phpAds_config['tbl_affiliates'] . " AS a" . " WHERE z.affiliateid=a.affiliateid" . " AND agencyid=" . $agencyid . " AND zonetype=" . phpAds_ZoneCampaign . phpAds_getZoneListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
$zone_count = phpAds_dbNumRows($res);
while ($row = phpAds_dbFetchArray($res)) {
    if (isset($affiliates[$row['affiliateid']])) {
        $row['linked'] = phpAds_IsCampaignInZone($campaignid, $row['zoneid'], $row['what']);
        $affiliates[$row['affiliateid']]['zones'][$row['zoneid']] = $row;
    }
}
$tabindex = 1;
echo "<br><br>";
echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
echo "<form name='zones' action='campaign-zone.php' method='post'>";
echo "<input type='hidden' name='clientid' value='" . $clientid . "'>";
echo "<input type='hidden' name='campaignid' value='" . $campaignid . "'>";
echo "<tr height='25'>";
echo '<td height="25" width="40%"><b>&nbsp;&nbsp;<a href="campaign-zone.php?clientid=' . $clientid . '&campaignid=' . $campaignid . '&listorder=name">' . $GLOBALS['strName'] . '</a>';