Resend my activation email : Register : Log in 
BCF: Bike Chat Forums


php ad code

Reply to topic
Bike Chat Forums Index -> The Geek Zone
View previous topic : View next topic  
Author Message

Marmalade
World Chat Champion



Joined: 28 Apr 2009
Karma :

PostPosted: 20:38 - 09 Feb 2011    Post subject: php ad code Reply with quote

Righty

On a little forum i run i have a banner at the top of the page that auto displays some affiliate ads, these are a waste of time and brought in a total of about £18 in the last 17 months and would like it to at least cover the hosting costs so want to be able to display google ads as well into the randomness, but, how do i do this.

The google ad code is this

Code:
<script type="text/javascript"><!--
google_ad_client = "ca-pub-5945362558941022";
/* cwindextop */
google_ad_slot = "0002837345";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>


and the code for the adbox ads is below, how would i go about putting the google code into one of the slots?

The #### is simply to not be spamming bcf

Code:
<?php
$filePath = '..';

$paidAds[0] = // ######map
   "<a href='http://www.#####.co.uk/forums/viewtopic.php?f=6&t=3904' title='Find out about getting on the ###### map, click here' target='_blank'><img src='" . $filePath . "/images/banners/#####.gif' alt='Find out about getting on the ###### map, click here' style='border:none;'  /></a>";

$paidAds[1] = // vistaprint
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=1064&programmeID=3161&mediaID=82863&tracking=&url='><img border=0 src='http://banners.affiliatefuture.com/1064/82863.gif'></a>";

$paidAds[2] = // ### ad pd to 31-04-10
   "<a href='http://www.#####.co.uk/' title='####light Transport' target='_blank'><img src='" . $filePath . "/images/banners/rlt1.gif' alt='##### light Transport' style='border:none;'  /></a>";

$paidAds[3] = // travelcash
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=4646&programmeID=11982&mediaID=92907&tracking=&url='><img border=0 src='http://banners.affiliatefuture.com/4646/92907.gif'></a>";

$paidAds[4] = // Catalink
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=323&programmeID=1128&mediaID=4499&tracking=&url='><img border=0 src='http://banners.affiliatefuture.com/323/4499.gif'></a>";


$paidAds[5] = // get geared
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=578&programmeID=1995&mediaID=94755&tracking=&url='><img border=0 src='http://banners.affiliatefuture.com/578/94755.gif'></a>";

$paidAds[6] = // my pix
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=367&programmeID=1444&mediaID=6197&tracking=&url='><img border=0 src='http://banners.affiliatefuture.com/367/6197.gif'></a>";

$paidAds[7] = // ######
   "<a href='http://www.####.co.uk' title='##### web site' target='_blank'><img src='" . $filePath . "/images/banners/#####.gif' alt='#####' style='border:none;'  /></a>";

$paidAds[8] = // POD####
   "<a href='http://www.thepodfather.com/sector.php?sectorID=16' title='The POD####' target='_blank'><img src='" . $filePath . "/images/banners/POD#####.gif' alt='POD#####' style='border:none;'  /></a>";

$paidAds[9] = // ####
   "<a href='http://www.#####.org.uk/#######-driver-shop-stick2.php' title='####' target='_blank'><img src='" . $filePath . "/images/banners/stickersbanner2.gif' alt='####' style='border:none;'  /></a>";

$paidAds[10] = // she####
   "<a href='http://www.sh####.co.uk' title='she####' target='_blank'><img src='" . $filePath . "/images/banners/headscrewedon4cw.gif' alt='sh###' style='border:none;'  /></a>";




$x = rand(0,10);
if (isset($_GET['displayad'])) $x = (int)$_GET['displayad'];
$paidAdToDisplay = $paidAds[$x];

echo $paidAdToDisplay;

?>


I don't know why bikechatforums has appeared in the code, see, i'm useless
____________________
Nobby the Bastard: How yo tell the difference between the actual japanese and her just screaming because she's had live fish stuck up her arse? [url=https://www.nicks-shop.co.uk/bcf-goodies-15-c.aspGet BCF stickers and things here[/url] Reflective helmet stickers - Legal requirement in france - Clicky
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts

Frost
World Chat Champion



Joined: 26 May 2004
Karma :

PostPosted: 20:47 - 09 Feb 2011    Post subject: Reply with quote

There are 2 <script> blocks. Stick the first one in your page header, spit the 2nd one out where you want your image. Don't forget to escape the characters so it's a valid string and displays correctly.
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts

Wabby
Trackday Trickster



Joined: 25 Sep 2007
Karma :

PostPosted: 21:06 - 09 Feb 2011    Post subject: Reply with quote

Add

Code:
$paidAds[11] = // adwords
   "<script type=\"text/javascript\"><!--
google_ad_client = \"ca-pub-5945362558941022\";
/* cwindextop */
google_ad_slot = \"0002837345\";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type=\"text/javascript\"
src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
</script>";


after advert 10

and change

Code:
$x = rand(0,10);


to

Code:
$x = rand(0,11);


Total code (commented out as per your demo script)

Code:
<?php
$filePath = '..';

$paidAds[0] = // ######map
   "<a href='http://www.#####.co.uk/forums/viewtopic.php?f=6&t=3904' title='Find out about getting on the ###### map, click here' target='_blank'><img src='" . $filePath . "/images/banners/#####.gif' alt='Find out about getting on the ###### map, click here' style='border:none;'  /></a>";

$paidAds[1] = // vistaprint
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=1064&programmeID=3161&mediaID=82863&tracking=&url='><img border=0 src='http://cdn.bikechatforums.com/http://banners.affiliatefuture.com/1064/82863.gif'></a>";

$paidAds[2] = // ### ad pd to 31-04-10
   "<a href='http://www.#####.co.uk/' title='####light Transport' target='_blank'><img src='" . $filePath . "/images/banners/rlt1.gif' alt='##### light Transport' style='border:none;'  /></a>";

$paidAds[3] = // travelcash
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=4646&programmeID=11982&mediaID=92907&tracking=&url='><img border=0 src='http://cdn.bikechatforums.com/http://banners.affiliatefuture.com/4646/92907.gif'></a>";

$paidAds[4] = // Catalink
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=323&programmeID=1128&mediaID=4499&tracking=&url='><img border=0 src='http://cdn.bikechatforums.com/http://banners.affiliatefuture.com/323/4499.gif'></a>";


$paidAds[5] = // get geared
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=578&programmeID=1995&mediaID=94755&tracking=&url='><img border=0 src='http://cdn.bikechatforums.com/http://banners.affiliatefuture.com/578/94755.gif'></a>";

$paidAds[6] = // my pix
   "<a href='http://scripts.affiliatefuture.com/AFClick.asp?affiliateID=218739&merchantID=367&programmeID=1444&mediaID=6197&tracking=&url='><img border=0 src='http://cdn.bikechatforums.com/http://banners.affiliatefuture.com/367/6197.gif'></a>";

$paidAds[7] = // ######
   "<a href='http://www.####.co.uk' title='##### web site' target='_blank'><img src='" . $filePath . "/images/banners/#####.gif' alt='#####' style='border:none;'  /></a>";

$paidAds[8] = // POD####
   "<a href='http://www.thepodfather.com/sector.php?sectorID=16' title='The POD####' target='_blank'><img src='" . $filePath . "/images/banners/POD#####.gif' alt='POD#####' style='border:none;'  /></a>";

$paidAds[9] = // ####
   "<a href='http://www.#####.org.uk/#######-driver-shop-stick2.php' title='####' target='_blank'><img src='" . $filePath . "/images/banners/stickersbanner2.gif' alt='####' style='border:none;'  /></a>";

$paidAds[10] = // she####
   "<a href='http://www.sh####.co.uk' title='she####' target='_blank'><img src='" . $filePath . "/images/banners/headscrewedon4cw.gif' alt='sh###' style='border:none;'  /></a>";


$paidAds[11] = // adwords
   "<script type=\"text/javascript\"><!--
google_ad_client = \"ca-pub-5945362558941022\";
/* cwindextop */
google_ad_slot = \"0002837345\";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type=\"text/javascript\"
src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">
</script>";



$x = rand(0,11);
if (isset($_GET['displayad'])) $x = (int)$_GET['displayad'];
$paidAdToDisplay = $paidAds[$x];

echo $paidAdToDisplay;

?>

____________________
What restriction?
 Back to top
View user's profile Send private message You must be logged in to rate posts

Wabby
Trackday Trickster



Joined: 25 Sep 2007
Karma :

PostPosted: 21:09 - 09 Feb 2011    Post subject: Reply with quote

If you still cant do it, PM me the original code with urls in, and I will PM you the script back working.
____________________
What restriction?
 Back to top
View user's profile Send private message You must be logged in to rate posts

Marmalade
World Chat Champion



Joined: 28 Apr 2009
Karma :

PostPosted: 21:34 - 09 Feb 2011    Post subject: Reply with quote

Wabby wrote:
If you still cant do it, PM me the original code with urls in, and I will PM you the script back working.


My hero, It's working fine and deleted all the affiliate ads, bit of luck the google ads will cover the minimal costs now

Thanks for all replies Thumbs Up

Knew there were some clever people on here
____________________
Nobby the Bastard: How yo tell the difference between the actual japanese and her just screaming because she's had live fish stuck up her arse? [url=https://www.nicks-shop.co.uk/bcf-goodies-15-c.aspGet BCF stickers and things here[/url] Reflective helmet stickers - Legal requirement in france - Clicky
 Back to top
View user's profile Send private message Send e-mail You must be logged in to rate posts
Old Thread Alert!

The last post was made 15 years, 240 days ago. Instead of replying here, would creating a new thread be more useful?
  Display posts from previous:   
This page may contain affiliate links, which means we may earn a small commission if a visitor clicks through and makes a purchase. By clicking on an affiliate link, you accept that third-party cookies will be set.

Post new topic   Reply to topic    Bike Chat Forums Index -> The Geek Zone All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Read the Terms of Use! - Powered by phpBB © phpBB Group
 

Debug Mode: ON - Server: birks (www) - Page Generation Time: 0.09 Sec - Server Load: 0.66 - MySQL Queries: 13 - Page Size: 55.83 Kb