I am completely stumped on this one. COMPLETELY stumped.
I'm building the framework for an ad network. While prototyping, I did most my building at Kodingen. Everything worked fine over there. I just migrated to a new host, though, and I've got this one weird problem. Weird.
Bear with me as I explain this.
The ads for my ad network are placed through a code snippet that the user places on his site. Here's the code snippet:
<script type="text/javascript">
document.write('<scr' + 'ipt type="text/javascript" src="http://mysite.net/ad_engine.php?pid=333"></scr' + 'ipt>');
</script>
And, after PHP processes the request, here's the output on the ad_engine.php page:
document.write("<div class='adframe' style='min-width:250px; min-height:100px;'><a href='click.php?adid=4224&pid=333' target='_self''><img src='http://mysite.net/ads/image.png' border='0' class='adimage' style='min-width:125px; min-height:100px;' /></a><span class='adtext'><a href='click.php?adid=4224&pid=333' target='_self''>This is the ad contents right here</a></span></div>");
This method worked fine when I was developing on Kodingen. The ad appeared on any page I placed this snippet on. But, since having migrated to my new server - and not having changed anything - this method won't work.
ON THE NEW SERVER: ad_engine.php, when typed directly into the address bar, shows the ad like usual. But when it's loaded onto any other page via that first code snippet I showed you, the ad won't appear. Strangely enough, the OLD ad_engine.php file - the one on my old host - still works fine even if I load it onto a page on my new host. Follow?
Although no ad appears, I know that the ad_engine.php page, the one on my new host, I know that it IS being processed, because MySQL changes are made like they're supposed to.
I've tried to be as clear as I can in explaining this problem, if you've got any questions just let me know.
Help?
register_globals
could be switched off now, for instance? It would probably be pretty helpful if you put an actual URL of the JS file on your server for people to test with. – Grim... Jan 28 '12 at 1:17ini_set('display_errors',0);
at the very top ofad_engine.php
. You need to look at the raw output ofad_engine.php
(as do we). And that looks like a slightly odd way of adding a new script to the DOM - for one thing,document.write
makes me shudder... – DaveRandom Jan 28 '12 at 1:23application/javascript
header? – Beetroot-Beetroot Jan 28 '12 at 2:07