require_once("conn.php");
require_once("includes.php");
require_once("access.php");
if(isset($_POST[s1]))
{
$MyFile = $_FILES[NewBanner][name];
if(!ereg("gif$", $MyFile) && !ereg("jpg$", $MyFile))
{
$error = "
You can upload only image files!";
}
else
{
$t = time();
$BannerName = $t."_".$MyFile;
//upload the new banner
copy($_FILES[NewBanner][tmp_name], "banners/$BannerName");
$cats = explode("|", $_POST[ListCategory]);
//record the banner info
$q1 = "insert into yellow_banners set
ClientID = '$_SESSION[AgentID]',
BannerURL = '$_POST[BannerURL]',
BannerFile = '$BannerName',
BannerAlt = '$_POST[BannerAlt]',
BannerType = '$_POST[BannerType]' ";
mysql_query($q1) or die(mysql_error());
}
}
//show the client's banners
$q1 = "select * from yellow_banners where ClientID = '$_SESSION[AgentID]' ";
$r1 = mysql_query($q1) or die(mysql_error());
while($a1 = mysql_fetch_array($r1))
{
$q2 = "select sum(clicks) from yellow_stats where BannerID = '$a1[BannerID]' ";
$r2 = mysql_query($q2) or die(mysql_error());
$a2 = mysql_fetch_array($r2);
$ShowBanners .= "";
$ShowBanners .= "\n\t\n\t\n\t | \n
\n";
$ShowBanners .= "\n\tClicks: $a2[0] (delete) | \n
\n
\n\n
\n\n";
}
require_once("templates/HeaderTemplate.php");
require_once("templates/UploadBannerTemplate.php");
require_once("templates/FooterTemplate.php");
?>