ich bin Mitglied in einem Affiliate Programm und möchte nun die angebotenen Werbebanner in meine Webseite einbauen. Damit nun nicht immer der gleiche Banner angezeigt wird, habe ich mir im Netz folgendes PHP Programm rausgesucht:
Banner Simple
Meine Idee war, die ganzen URLs zu den einzelnen Banner in eine Datei auf meinem Server zu packen und das Programm sucht sich dann automatisch bei jedem Besuch der Seite einen anderen Banner aus. Nur leider bekomme ich das ganze nicht zum Laufen... Folgendes habe ich gemacht:
Habe direkt auf der obersten Ebene (www.gamepals.de) die Dateien "banner.php" und "mybanner_468x60.txt" angelegt. Diese Dateien sehen momentan so aus:
<?php /* Banner Simple, Version 1.0 * by Dan Kaplan <[email protected]> * Last Modified: January 10, 2003 * -------------------------------------------------------------------- * * USE THIS LIBRARY AT YOUR OWN RISK; no warranties are expressed or * implied. You may modify the file however you see fit, so long as * you retain this header information and any credits to other sources * throughout the file. If you make any modifications or improvements, * please send them via email to Dan Kaplan <[email protected]>. * -------------------------------------------------------------------- */ $base_dir = 'www.gamepals.de'; $img_url = 'templates/gamepals07/img/'; // add any banner sizes (width x height) that you will use: // IAB Standards & Guidelines: http://www.iab.net/standards/adunits.asp $banner_sizes = array ("468x60", "100x60", "100x38", "300x250", "250x250", "240x400", "336x280", "180x150", "468x60", "234x60", "88x31", "120x90", "120x60", "120x240", "125x125", "160x600", "120x600"); $srand_called = FALSE; $last_file = ''; $array = ''; function get_banner($size='') { global $base_dir, $img_url, $banner_sizes, $srand_called, $last_file, $array; if (empty($size) || !in_array($size, $banner_sizes)) { $size = "468x60"; } $size_split = explode("x", $size); $width = $size_split[0]; $height = $size_split[1]; if (empty($last_file) || ($size != $last_file) || !is_array($array)) { // if calling muliple banners on one page, no need to read in the same file repeatedly. so, // if the last banner file read in is the next one called, pull the $array array from memory. $file = $base_dir."/mybanner_".$size.".txt"; if (!file_exists($file)) { // could not load the banner file, so create a default blank image and exit $banner = "<img src=\"\" width=\"$width\" height=\"$height\" border=\"0\" alt=\"broken image\">"; return $banner; } $array = file($file); // read $file into an array $last_file = $size; // save the last read-in file into memory } if (!$srand_called) { // slightly less random without this; srand() should only be called once for multiple banners mt_srand ((double) microtime() * 1000000); $srand_called = TRUE; } $rand = mt_rand(1, count($array)-1); // start at 1 to ignore comment line $line = chop($array[$rand]); # URL | target="_blank" (1/0) | off-site image (1/0) | image | Alt text $banner_split = explode("|", $line); $URL = $banner_split[0]; $blank = $banner_split[1]; $off_site = $banner_split[2]; $image = $banner_split[3]; $alt = $banner_split[4]; if ($blank == 1) { $target = "target=\"_blank\""; } else { $target = ""; } if ($off_site == 1) { $image = $image; } else { $image = "$img_url/$image"; } $banner = "<a href=\"$URL\" $target><img src=\"$image\" width=\"$width\" height=\"$height\" border=\"0\" alt=\"$alt\"></a>"; return $banner; } ?>
http://partners.webmasterplan.com/click.asp?ref=418763&site=1331&type=b8&bnb=8|1|1|http://banners.webmasterplan.com/view.asp?ref=418763&site=1331&b=11|GAME WORLD Computer- und Videospiele
und auf der Webseite wird das Programm innerhalb eines Programms so aufgerufen:
<div id="ads">
<?php
include("/banner.php");
echo get_banner("468x60");
?>
</div>
Wo habe ich da den entscheidenden Fehler gemacht?

Hilfe
Neues Thema
Antworten

Nach oben


