Jump to content

[SOLVED] JS banner syndication help


jetsettt

Recommended Posts

Can anyone help me out here, it should be straight forward but I am now stuck  :confused:

 

I am running banner ads on a number of websites sites and all the banner images are stored at my website (http://mybannersite.com/banners/). All the banners are simply coded into the website pages as such...

 

<a href="http://linktothesite.com"><img src="http://mybannersitecom/banners/bannerad-500x75.gif" width="500" height="75"></a>

 

To make all this more manageable, I want to pull all the banners from a database using javascript that calls a PHP page, which is working fine until you add a parameter ?!?!

 

Heres the code (includes 3 PHP files)

 

Javascript code that is added the website to display the banner. (the parameter 'banner' breaks everything)

 

<script type="text/javascript"
src="http://mybannersitecom/banner.php?banner=45">
</script>

 

Code in banner.php page

 

<?php
include('makejavascript.php');
include('content.php');
?>

 

 

Code in makejavascript.php page

 

<?php
function ob_makejavascripthandler($output) {
  return sprintf('document.write(unescape("%s"));',
                 rawurlencode($output));
}
ob_start("ob_makejavascripthandler");
?>

 

Content.php contains the database query.

 

All works fine if a query is used without parameters. When a parameter is added it only outputs 'document.write(unescape(""));'

 

I can't see or drill down any further where this is breaking. I've checked the web server logs and no errors, just the log of the requested url.

I think it is the makejavascript.php page that is the problem but I can't make it work.

 

Can anyone help?

 

Thanks

Steve

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.