if (!isset($listorder)) {
    if (isset($Session['prefs']['campaign-trackers.php']['listorder'])) {
        $listorder = $Session['prefs']['campaign-trackers.php']['listorder'];
    } else {
        $listorder = '';
    }
}
if (!isset($orderdirection)) {
    if (isset($Session['prefs']['campaign-trackers.php']['orderdirection'])) {
        $orderdirection = $Session['prefs']['campaign-trackers.php']['orderdirection'];
    } else {
        $orderdirection = '';
    }
}
// Get other trackers
$res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . phpAds_getCampaignListOrder($navorder, $navdirection));
while ($row = phpAds_dbFetchArray($res)) {
    phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "campaign-trackers.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']);
}
if (phpAds_isUser(phpAds_Admin) || phpAds_isUser(phpAds_Agency)) {
    phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif');
    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'>&nbsp;{$strMoveTo}<br>" . "\n";
    $extra .= "\t\t\t\t<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>" . "\n";
}
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
if (isset($Session['prefs']['advertiser-campaigns.php'][$clientid]['listorder'])) {
    $navorder = $Session['prefs']['advertiser-campaigns.php'][$clientid]['listorder'];
} else {
    $navorder = '';
}
if (isset($Session['prefs']['advertiser-campaigns.php'][$clientid]['orderdirection'])) {
    $navdirection = $Session['prefs']['advertiser-campaigns.php'][$clientid]['orderdirection'];
} else {
    $navdirection = '';
}
// Get other campaigns
$res = phpAds_dbQuery("\n\tSELECT\n\t\t*\n\tFROM\n\t\t" . $phpAds_config['tbl_campaigns'] . "\n\tWHERE\n\t\tclientid = " . $clientid . "\n\t" . phpAds_getCampaignListOrder($navorder, $navdirection) . "\n");
while ($row = phpAds_dbFetchArray($res)) {
    phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "campaign-banners.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']);
}
phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif');
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='clientid' value='{$clientid}'>\n";
$extra .= "\t\t\t\t<input type='hidden' name='campaignid' value='{$campaignid}'>\n";
$extra .= "\t\t\t\t<input type='hidden' name='returnurl' value='campaign-banners.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'>&nbsp;{$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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n";
$checkedall = true;
$campaignshidden = 0;
$default_viewwindow = $phpAds_config['default_conversion_viewwindow'];
$default_clickwindow = $phpAds_config['default_conversion_clickwindow'];
if (isset($trackerid) && $trackerid > 0) {
    $res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_campaigns_trackers'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie();
    while ($row = phpAds_dbFetchArray($res)) {
        $campaign_tracker_row[$row['campaignid']] = $row;
    }
    $res = phpAds_dbQuery("SELECT" . " viewwindow" . ",clickwindow" . " FROM " . $phpAds_config['tbl_trackers'] . " WHERE trackerid=" . $trackerid) or phpAds_sqlDie();
    if ($row = phpAds_dbFetchArray($res)) {
        $default_viewwindow = $row['viewwindow'];
        $default_clickwindow = $row['clickwindow'];
    }
}
$res = phpAds_dbQuery("SELECT *" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . phpAds_getCampaignListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
if (phpAds_dbNumRows($res) == 0) {
    echo "\t\t\t\t<tr bgcolor='#F6F6F6'>\n";
    echo "\t\t\t\t\t<td colspan='4' height='25'>&nbsp;&nbsp;" . $strNoCampaignsToLink . "</td>\n";
    echo "\t\t\t\t</tr>\n";
} else {
    echo "\t\t\t\t<form name='availablecampaigns' method='post' action='tracker-campaigns.php'>\n";
    echo "\t\t\t\t<input type='hidden' name='trackerid' value='" . $GLOBALS['trackerid'] . "'>\n";
    echo "\t\t\t\t<input type='hidden' name='clientid' value='" . $GLOBALS['clientid'] . "'>\n";
    echo "\t\t\t\t<input type='hidden' name='action' value='set'>\n";
    while ($row = phpAds_dbFetchArray($res)) {
        $campaigns[$row['campaignid']] = $row;
    }
    for (reset($campaigns); $ckey = key($campaigns); next($campaigns)) {
        $campaign = $campaigns[$ckey];
        if ($campaign['active'] == 't' || $hideinactive != '1') {
        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'>&nbsp;<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'>&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("2.1.2.1", "2.1.2.2", "2.1.2.3", "2.1.2.4", "2.1.2.5"));
}
/*********************************************************/
/* Main code                                             */
}
if (isset($Session['prefs']['stats-global-advertiser.php']['nodes'])) {
    $node_array = explode(",", $Session['prefs']['stats-global-advertiser.php']['nodes']);
} else {
    $node_array = array();
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
// Get clients & campaign and build the tree
if (phpAds_isUser(phpAds_Admin)) {
    $res_clients = phpAds_dbQuery("SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . phpAds_getClientListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
    $res_campaigns = phpAds_dbQuery("SELECT campaignid,campaignname,clientid,views,clicks,conversions,active" . " FROM " . $phpAds_config['tbl_campaigns'] . phpAds_getCampaignListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
} elseif (phpAds_isUser(phpAds_Agency)) {
    $res_clients = phpAds_dbQuery("SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE agencyid=" . phpAds_getUserID() . phpAds_getClientListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
    $res_campaigns = phpAds_dbQuery("SELECT m.campaignid as campaignid" . ",m.campaignname as campaignname" . ",m.clientid as clientid" . ",m.views as views" . ",m.clicks as clicks" . ",m.conversions as conversions" . ",m.active as active" . " FROM " . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE m.clientid=c.clientid" . " AND c.agencyid=" . phpAds_getUserID() . phpAds_getCampaignListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
}
while ($row_clients = phpAds_dbFetchArray($res_clients)) {
    $clients[$row_clients['clientid']] = $row_clients;
    $clients[$row_clients['clientid']]['expand'] = 0;
    $clients[$row_clients['clientid']]['count'] = 0;
    $clients[$row_clients['clientid']]['hideinactive'] = 0;
}
while ($row_campaigns = phpAds_dbFetchArray($res_campaigns)) {
    $campaigns[$row_campaigns['campaignid']] = $row_campaigns;
    $campaigns[$row_campaigns['campaignid']]['expand'] = 0;
    $campaigns[$row_campaigns['campaignid']]['count'] = 0;
}
switch ($period) {
    case 't':
        $timestamp = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
        phpAds_PageHeader("1.2.2.4");
        echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getCampaignName($campaignid);
        echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
        echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<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'>&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;" . phpAds_getCampaignName($campaignid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<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"));
    if (isset($Session['prefs']['advertiser-campaigns.php'][$clientid]['orderdirection'])) {
        $orderdirection = $Session['prefs']['advertiser-campaigns.php'][$clientid]['orderdirection'];
    } else {
        $orderdirection = '';
    }
}
if (isset($Session['prefs']['advertiser-campaigns.php'][$clientid]['nodes'])) {
    $node_array = explode(",", $Session['prefs']['advertiser-campaigns.php'][$clientid]['nodes']);
} else {
    $node_array = array();
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
// Get clients & campaign and build the tree
$res_campaigns = phpAds_dbQuery("SELECT *" . ",DATE_FORMAT(expire, '{$date_format}') AS expire_f" . ",DATE_FORMAT(activate, '{$date_format}') AS activate_f" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . $clientid . phpAds_getCampaignListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
while ($row_campaigns = phpAds_dbFetchArray($res_campaigns)) {
    $campaigns[$row_campaigns['campaignid']] = $row_campaigns;
    $campaigns[$row_campaigns['campaignid']]['expand'] = 0;
    $campaigns[$row_campaigns['campaignid']]['count'] = 0;
}
// Get the banners for each campaign
$res_banners = phpAds_dbQuery("\n\tSELECT \n\t\tbannerid,\n\t\tcampaignid,\n\t\talt,\n\t\tdescription,\n\t\tactive,\n\t\tstoragetype\n\tFROM \n\t\t" . $phpAds_config['tbl_banners'] . "\n\t\t" . phpAds_getBannerListOrder($listorder, $orderdirection) . "\n\t") or phpAds_sqlDie();
while ($row_banners = phpAds_dbFetchArray($res_banners)) {
    if (isset($campaigns[$row_banners['campaignid']])) {
        $banners[$row_banners['bannerid']] = $row_banners;
        $campaigns[$row_banners['campaignid']]['count']++;
    }
}
// Add ID found in expand to expanded nodes
if (isset($expand) && $expand != '') {
if (isset($Session['prefs']['advertiser-index.php']['nodes'])) {
    $node_array = $Session['prefs']['advertiser-index.php']['nodes'];
}
/*********************************************************/
/* Main code                                             */
/*********************************************************/
// Get clients & campaign and build the tree
if (phpAds_isUser(phpAds_Admin)) {
    $res_clients = phpAds_dbQuery("SELECT clientid, clientname" . " FROM " . $phpAds_config['tbl_clients'] . phpAds_getClientListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
    $res_campaigns = phpAds_dbQuery("SELECT campaignid,clientid,campaignname,active" . " FROM " . $phpAds_config['tbl_campaigns'] . phpAds_getCampaignListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
} elseif (phpAds_isUser(phpAds_Agency)) {
    $res_clients = phpAds_dbQuery("SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE agencyid=" . phpAds_getUserID() . phpAds_getClientListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
    $res_campaigns = phpAds_dbQuery("SELECT m.campaignid as campaignid" . ",m.clientid as clientid" . ",m.campaignname as campaignname" . ",m.active as active" . " FROM " . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE c.clientid=m.clientid" . " AND c.agencyid=" . phpAds_getUserID() . phpAds_getCampaignListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
} elseif (phpAds_isUser(phpAds_Client)) {
    $res_clients = phpAds_dbQuery("SELECT clientid,clientname" . " FROM " . $phpAds_config['tbl_clients'] . " WHERE clientid=" . phpAds_getUserID() . phpAds_getClientListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
    $res_campaigns = phpAds_dbQuery("SELECT campaignid,campaignname,active" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid=" . phpAds_getUserID() . phpAds_getCampaignListOrder($listorder, $orderdirection)) or phpAds_sqlDie();
}
while ($row_clients = phpAds_dbFetchArray($res_clients)) {
    $clients[$row_clients['clientid']]['clientid'] = $row_clients['clientid'];
    $clients[$row_clients['clientid']]['clientname'] = $row_clients['clientname'];
    $clients[$row_clients['clientid']]['expand'] = FALSE;
    $clients[$row_clients['clientid']]['count'] = 0;
    $clients[$row_clients['clientid']]['hideinactive'] = 0;
}
while ($row_campaigns = phpAds_dbFetchArray($res_campaigns)) {
    $campaigns[$row_campaigns['campaignid']]['campaignid'] = $row_campaigns['campaignid'];
    $campaigns[$row_campaigns['campaignid']]['campaignname'] = $row_campaigns['campaignname'];
    $campaigns[$row_campaigns['campaignid']]['clientid'] = $row_campaigns['clientid'];
    $campaigns[$row_campaigns['campaignid']]['active'] = $row_campaigns['active'];
    $campaigns[$row_campaigns['campaignid']]['count'] = 0;
    $campaigns[$row_campaigns['campaignid']]['expand'] = FALSE;
}
/*********************************************************/
/* HTML framework                                        */
/*********************************************************/
if (isset($Session['prefs']['advertiser-campaigns.php'][$clientid]['listorder'])) {
    $navorder = $Session['prefs']['advertiser-campaigns.php'][$clientid]['listorder'];
} else {
    $navorder = '';
}
if (isset($Session['prefs']['advertiser-campaigns.php'][$clientid]['orderdirection'])) {
    $navdirection = $Session['prefs']['advertiser-campaigns.php'][$clientid]['orderdirection'];
} else {
    $navdirection = '';
}
// Get other campaigns
$res = phpAds_dbQuery("SELECT campaignid,campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " WHERE clientid = " . $clientid . phpAds_getCampaignListOrder($navorder, $navdirection)) or phpAds_sqlDie();
while ($row = phpAds_dbFetchArray($res)) {
    phpAds_PageContext(phpAds_buildName($row['campaignid'], $row['campaignname']), "campaign-zone.php?clientid=" . $clientid . "&campaignid=" . $row['campaignid'], $campaignid == $row['campaignid']);
}
phpAds_PageShortcut($strClientProperties, 'advertiser-edit.php?clientid=' . $clientid, 'images/icon-advertiser.gif');
phpAds_PageShortcut($strCampaignHistory, 'stats-campaign-history.php?clientid=' . $clientid . '&campaignid=' . $campaignid, 'images/icon-statistics.gif');
$extra = "<form action='campaign-modify.php'>";
$extra .= "<input type='hidden' name='clientid' value='{$clientid}'>";
$extra .= "<input type='hidden' name='campaignid' value='{$campaignid}'>";
$extra .= "<input type='hidden' name='returnurl' value='campaign-banners.php'>";
$extra .= "<br><br>";
$extra .= "<b>{$strModifyCampaign}</b><br>";
$extra .= "<img src='images/break.gif' height='1' width='160' vspace='4'><br>";
$extra .= "<img src='images/icon-move-campaign.gif' align='absmiddle'>&nbsp;{$strMoveTo}<br>";
$extra .= "<img src='images/spacer.gif' height='1' width='160' vspace='2'><br>";
$extra .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
        $sections[] = "1.2.2.4";
        phpAds_PageHeader("1.2.2.4");
        echo "<img src='images/icon-campaign.gif' align='absmiddle'>&nbsp;" . phpAds_getCampaignName($campaignid);
        echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
        echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<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);
    }
} elseif (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 AS campaignid" . ",m.campaignname AS campaignname" . " FROM " . $phpAds_config['tbl_campaigns'] . " AS m" . "," . $phpAds_config['tbl_clients'] . " AS c" . " WHERE c.clientid=m.clientid" . " AND m.clientid=" . $clientid . 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-banners.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'>&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;" . phpAds_getCampaignName($campaignid);
    echo "&nbsp;<img src='images/" . $phpAds_TextDirection . "/caret-rs.gif'>&nbsp;";
    echo "<img src='images/icon-banner-stored.gif' align='absmiddle'>&nbsp;<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"));