elseif($_POST["save"]) {
$banner=$_FILES["banner"];
$bannername=$_POST["bannername"];
$bannerurl=$_POST["bannerurl"];
$displayed=$_POST["displayed"];
if(!$displayed) $displayed=0;
echo'
<h2>bannerrotation</h2>
<input type="button" class="button" onClick="MM_goToURL(\'parent\',\'admincenter.php?site=bannerrotation&action=add\');return document.MM_returnValue" value="new banner">
<h2>new banner</h2>';
if($bannername AND $bannerurl AND $banner) {
if(eregi('http://', $bannerurl)) $bannerurl=$bannerurl;
else $bannerurl='http://'.$bannerurl;
$file_ext=strtolower(substr($banner[name], strrpos($banner[name], ".")));
if($file_ext==".gif" OR $file_ext==".jpg" OR $file_ext==".png") {
safe_query("INSERT INTO ".PREFIX."bannerrotation (bannerID, bannername, bannerurl, displayed, date) values('', '".$bannername."', '".$bannerurl."', '".$displayed."', '".time()."')");
$id=mysql_insert_id();
if($banner[name] != "") {
move_uploaded_file($banner[tmp_name], $filepath.$banner[name]);
@chmod($filepath.$banner[name], 0755);
$file=$id.$file_ext;
rename($filepath.$banner[name], $filepath.$file);
if(safe_query("UPDATE ".PREFIX."bannerrotation SET banner='".$file."' WHERE bannerID='".$id."'")) {
redirect("admincenter.php?site=bannerrotation", "Banner created.", "3");
} else {
redirect("admincenter.php?site=bannerrotation", "Banner could not be created", "3");
}
}
} else echo'[b]The format of the icon was incorrect. Please upload only banner in *.gif, *.jpg and *.png format.[/b]
[
url="javascript
:history.back()"]« back[/
url]';
} else echo'[b]Please fill in the form correctly.[/b]
[
url="javascript
:history.back()"]« back[/
url]';
}