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
https://forums.phpfreaks.com/topic/176302-solved-js-banner-syndication-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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