Forum Moderators: open
I was trying to install phpadsnew and got through the part where i can rotate between google adsense and ypn ads. However, i noticed that when i am using the remote invocation for javascript type, i can't get the real javascript source pulled up from the source file, means when i view the source file of the page, it is showing something ;like this:-
<script language='JavaScript' type='text/javascript' src='http://www.mysite.com/phpadsnew/adx.js'></script>
<script language='JavaScript' type='text/javascript'>
<!--
if (!document.phpAds_used) document.phpAds_used = ',';
phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
document.write ("http://www.mysite.com/phpadsnew/adjs.php?n=" + phpAds_random);
document.write ("&what=zone:3&withText=1");
document.write ("&exclude=" + document.phpAds_used);
if (document.referrer)
document.write ("&referer=" + escape(document.referrer));
document.write ("'><" + "/script>");
//-->
</script><noscript><a href='http://www.mysite.com/phpadsnew/adclick.php?n=a35a85bd' target='_blank'><img src='http://www.mysite.com/phpadsnew/adview.php?what=zone:3&n=a35a85bd' border='0' alt=''></a></noscript>
That's why i was wondering whether this is allowed per TOS? Because i can't seem to view the javascript pulled from ypn or adsense server.
In fact, if i use the local mode for phpadsnew, i can see real javascript source code being pulled out like this:-
<script language="JavaScript" type="text/javascript">
<!--
ctxt_ad_partner = "myypnadcode";
ctxt_ad_section = "";
ctxt_ad_bg = "";
ctxt_ad_width = 250;
ctxt_ad_height = 250;
ctxt_ad_bc = "000000";
ctxt_ad_cc = "000000";
ctxt_ad_lc = "FFFFFF";
ctxt_ad_tc = "FFFFFF";
ctxt_ad_uc = "FFFFFF";
// -->
</script>
<script language="JavaScript" src="http://ypn-js.overture.com/partner/js/ypn.js">
</script><div id="beacon_4" style="position: absolute; left: 0px; top: 0px; visibility: hidden;"><img src='http://www.mysite.com/phpadsnew/adlog.php?bannerid=4&clientid=8&zoneid=3&source=&block=0&capping=0&cb=47b2a94244b0562b64ae67a2a2b909b6' width='0' height='0' alt='' style='width: 0px; height: 0px;'></div>
The problem is i have some static file where php is not available. So, any suggestions to this? thanks.
Just to add that i notice several big sites such as Jensense are using this method. The javascript code can't be viewed from the source file.
I decided in the end to go with straight SSI. Much faster for both the client and the server and it doesn't alter the ad code at all.
I created a set of files for my ads along the lines of this:
__ad_728x90.php
__ad_468x60.php
These files just set size variables and include a centralized file call __ad.php. This file loads up a simple PHP class I created called AdProvider.php. When loaded, the object decides which provider to use (if not explicitly told). For me, I just divide time in larger 1-minute chunks. For now, I divide time in half... 1 minute for AS, 1 minute for YPN, but I could divide time into 10 slices an assign which slices of time each gets. When MSN gets going, I'll just add them to the list of providers.
I might be making this sound more complicated than it is. But really, my rotation comes down to "time_in_minutes() % $slices".
Then in my website PHP pages, I include the _ad_XXXxYYY.php files as needed. Some pages I hard code the provider (ie. Yahoo performs better on those pages, so it gets 100%). Soon, I will be less absolute.
-Alex
<!--#if expr="${HTTP_ACCEPT_LANGUAGE} = /en/" -->
<!--#config timefmt=%S -->
<!--#if expr="$DATE_LOCAL = /^[0-5]([0-9])$/" -->
<!--#set var="Time" value="$1" -->
<!--#endif -->
<!--#if expr="($Time = /^[02468]$/) && (${HTTP_ACCEPT_LANGUAGE} = /en-us/)" -->
Show Yahoo ad.
<!--#else -->
Show Google ad.
<!--#endif -->
<!--#else -->
Show alternative ad.
<!--#endif -->
As for SSI, SSI scares the hell out of me. I work as an application security analyst, and SSI has so many security flaw implications that I'm amazed it's still supported.
-Alex
In fact, ironically enough, I've only had a server hacked once, because of a vulnerability in phpadsnew [trendmicro.com]. Go figure. My mistake for being lazy and using an off the shelf program (so to speak). Won't do that again.