Thread: php help
View Single Post
Old 2005-03-11, 09:02 AM   #5
Useless
Certified Nice Person
 
Useless's Avatar
 
Join Date: Oct 2003
Location: Dirty Undies, NY
Posts: 11,268
Send a message via ICQ to Useless
Quote:
Originally Posted by security_man
i would suggest phpadsnew
So would I. Once you get the hang of phpadsnew you can control an amazing amount of advertising with it.

But if you are looking for something simple that doesn't require databases, you can employ a tiny script that I found here at GG&Jim's.

Place this PHP statement on your page where you want your adverstising to appear:

<?php
$file = "bannerlist.txt";
$banners = file($file);
srand((float) microtime() * 1235689);
$selected = array_rand($banners);
$SelBanner = trim($banners[$selected]);
if ($SelBanner=="") {
$SelBanner = trim($banners[0]);
};
echo $SelBanner;
?>

You'll notice that it pulls it's info from a file called bannerlist.txt. So make a text document with that name and upload it to the same directory as the page with the PHP code above. Put each separate banner, text link, or whatever on its own line. It can pull in entire tables, just make sure you get rid of any carriage returns so that the entire table is on one line on bannerlist.txt.

Each banner or link will appear randomly with each page refresh. Here's a page that uses that code to control the banners before the listings: http://www.filthyearl.com/hot-babes/
This is the bannerlist.txt for that page:
http://www.filthyearl.com/hot-babes/bannerlist.txt

And to answer your question about where to store banners, be creative in naming your banner directory or place them any image folder. You really shouldn't use the term 'banner' in your exposed page code. A lot of surfers are using ad blocking software that will block any image or link with that term.
__________________
Click here to purchase a bridge I'm selling.
Useless is offline   Reply With Quote