bannerrotation

new banner

'; echo'
Banner-Upload:
Banner Name:
Banner URL:
Is displayed?
'; } elseif($_GET["action"]=="edit") { $ds=mysql_fetch_array(safe_query("SELECT * FROM ".PREFIX."bannerrotation WHERE bannerID='".$_GET["bannerID"]."'")); if(file_exists($filepath.$ds['bannerID'].'.gif')) $pic=''.$ds['banner'].''; elseif(file_exists($filepath.$ds['bannerID'].'.jpg')) $pic=''.$ds['banner'].''; else $pic='no image uploaded'; if($ds['displayed']=='1') $displayed=''; else $displayed=''; echo'

bannerrotation

edit banner - '.$ds['bannername'].'

'; echo'
Present Banner: '.$pic.'
Banner Upload:
Banner Name:
Banner URL:
Is displayed? '.$displayed.'
'; } elseif($_POST["save"]) { $banner=$_FILES["banner"]; $bannername=$_POST["bannername"]; $bannerurl=$_POST["bannerurl"]; $displayed=$_POST["displayed"]; if(!$displayed) $displayed=0; echo'

bannerrotation

new banner

'; 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'The format of the icon was incorrect. Please upload only banner in *.gif, *.jpg and *.png format.

« back'; } else echo'Please fill in the form correctly.

« back'; } elseif($_POST["saveedit"]) { $banner=$_FILES["banner"]; $bannername=$_POST["bannername"]; $bannerurl=$_POST["bannerurl"]; $displayed=$_POST["displayed"]; if(!$displayed) $displayed=0; echo'

banner

edit banner

'; if($banner AND $bannername AND $bannerurl) { if(eregi('http://', $bannerurl)) $bannerurl=$bannerurl; else $bannerurl='http://'.$bannerurl; if($banner[name]=="") { if(safe_query("UPDATE ".PREFIX."bannerrotation SET bannername='".$bannername."', bannerurl='".$bannerurl."', displayed='".$displayed."' WHERE bannerID='".$_POST["bannerID"]."'")) redirect("admincenter.php?site=bannerrotation", "Banner updated.", "3"); } else { $file_ext=strtolower(substr($banner[name], strrpos($banner[name], "."))); if($file_ext==".gif" OR $file_ext==".jpg" OR $file_ext==".png") { move_uploaded_file($banner[tmp_name], $filepath.$banner[name]); @chmod($filepath.$banner[name], 0755); $file=$_POST['bannerID'].$file_ext; rename($filepath.$banner[name], $filepath.$file); if(safe_query("UPDATE ".PREFIX."bannerrotation SET banner='".$file."', bannername='".$bannername."', bannerurl='".$bannerurl."', displayed='".$displayed."' WHERE bannerID='".$_POST["bannerID"]."'")) { header("Location: admincenter.php?site=bannerrotation"); } } else echo'The format of the icon was incorrect. Please upload only banner in *.gif, *.jpg and *.png format.

« back'; } } else echo'Please fill in the form correctly.

« back'; } elseif($_GET["delete"]) { if(safe_query("DELETE FROM ".PREFIX."bannerrotation WHERE bannerID='".$_GET["bannerID"]."'")) { if(file_exists($filepath.$_GET["bannerID"].'.jpg')) unlink($filepath.$_GET["bannerID"].'.jpg'); if(file_exists($filepath.$_GET["bannerID"].'.gif')) unlink($filepath.$_GET["bannerID"].'.gif'); if(file_exists($filepath.$_GET["bannerID"].'.png')) unlink($filepath.$_GET["bannerID"].'.png'); redirect("admincenter.php?site=bannerrotation", "Banner deleted.", "3"); } else { redirect("admincenter.php?site=bannerrotation", "Banner could not be deleted", "3"); } } else { echo'

bannerrotation

existing banners

'; $qry=safe_query("SELECT * FROM ".PREFIX."bannerrotation ORDER BY bannerID"); $anz=mysql_num_rows($qry); if($anz) { while($ds = mysql_fetch_array($qry)) { $ds[displayed]==1 ? $displayed='yes' : $displayed='no'; if(eregi('http://', $ds[bannerurl])) $bannerurl=''.$ds[bannerurl].''; else $bannerurl=''.$ds[bannerurl].''; $days=round((time()-$ds[date])/(60*60*24)); if($days) $perday=round($ds[hits]/$days,2); else $perday=$ds[hits]; echo' '; } } else echo''; echo '
Banner: Banner-URL: Clicks (per day) Is displayed? Actions:
'.$ds[bannername].' '.$bannerurl.' '.$ds[hits].' ('.$perday.') '.$displayed.'
no entries
'; } ?>