Jump to content

Recommended Posts

Posted

Below I have 2 scripts, I was wondering if some one could write the second script into the first one? I've tried but each attempt fails. The first is a google ad block for 468x60 ads the second is a javascript ad rotator.

 

<?php

if (eregi("block-GoogleBanner.php",$PHP_SELF)) {

Header("Location: index.php");

die();

}

?>

<script language="JavaScript">

<!--

google_ad_client = "mycode";

google_ad_width = 468;

google_ad_height = 60;

google_ad_format = "468x60_as";

google_ad_type = "text_image";

google_ad_channel ="";

//-->

</script>

<?php

$content .= "<center><script language=\"JavaScript\"

src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">";

$content .= "</script></center>";

?>

<script language="JavaScript">

<!-- Begin

rnd.today=new Date();

rnd.seed=rnd.today.getTime();

 

function rnd() {

rnd.seed = (rnd.seed*9301+49297) % 233280;

return rnd.seed/(233280.0);

};

 

function rand(number) {

var result = Math.ceil(rnd()*number);

if (!result)result++;

return result

};

var ad_cnt2 = 2;

var ad2 = rand(ad_cnt2);

var link2;

var adBanner2;

var width2

var height2

if (ad2==1) {

link2="http://affiliates.phpfox.com/idevaffiliate.php?id=252_0_1_7";

adBanner2="http://affiliates.phpfox.com/banners/468x60_02.gif";

width2="468";

height2="60";

alt2="Your own myspace!";

}

if (ad2==2) {

link2="http://www.mysite/ads/treasure.gif";

adBanner2="http://www.treasuretrooper.com/141751";

width2="468";

height2="60";

alt2="Make money online";

}

document.write('<center><a href="' + link2 + '" target="_blank">');

document.write('<img src="' + adBanner2 + '" width=' + width2 + ' height=' + height2 + ' border=0 alt="' + alt2 + '"></a>');

document.write('</center>');

// End -->

</SCRIPT>

Posted

The title is a bit confused - the first snippet is PHP, but the second snippet is Javascript. You can't just mix them together.

 

What is it you are trying to accomplish here? Rotate your Google ads?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...