I am a total newbie to php so if you could like post the exact code with example ypn and adsense codes in it, that would be great, then i could just copy and paste over the example ad codes
I couldn't do that because I don't exactly know what you want and how you want your ads to be shown. You're the only one to know that. You'll probably need changes even after everything's done, so you'd better get a grip on php.net and have a read, it's not that difficult Anyhow, if you need some php programming done you can PM me if you care to negotiate
alright well I guess i'll just continue to wait for someone to post some code that actually works for us newbies. peace
It's way too clear (the code above) so you could do it yourself without much trouble. In case you need something more difficult than simply copy/pasting the bits of code above, please do ask, but don't just expect for that code to simply jump into your php files... You're just being lazy!
People recommended me to leave the YPN Ads on by using geotargetting so I'd like to give it a shot and see how is it going . All we need to do is uploading geoip.inc and GeoIP.dat files to directory right? Then replace $visitor_country_code with the code below? If possible can you implement these two strings code for me please Very much appreciated, Tranix
Could you be more specific with the question, 'coz I don't get what you want. You've already done most of the work.
The code looks like this right? <?include("geoip.inc"); $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD); $visitor_country_code=<? switch ($visitor_country_code) { case "US": { switch ($vrand=rand(1,2)) { case 1: { //Display YPN ads for US visitors only ?> Insert YPN Ads code here <? } ?> ($gi, $_SERVER['REMOTE_ADDR']);$visitor_country_name=geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']); ?>
Erm... no.. That is just a big mess... I'll post a bit later the code, I'm busy now.. Hold on to your seats until then
Step by step: 1. Download these files: - GeoIP.dat from http://www.maxmind.com/app/geoip_country - geoip.inc from http://www.maxmind.com/download/geoip/api/php/ and put them where your php banner script will be. 2. The php banner script <? [COLOR="DarkOrange"]// This part gets the ip of the visitor and matches it to a country name/code[/COLOR] include("geoip.inc"); $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD); $visitor_country_code=geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); $visitor_country_name=geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']); [COLOR="DarkOrange"]//This part shows banners/codes that YOU decide for each country[/COLOR] switch ($visitor_country_name) { case "Australia": { ?> [COLOR="Olive"]<-- GOOGLE ADSENSE OR WHATEVER CODE SUITABLE FOR AUSTRALIA GOES HERE -->[/COLOR] <? } break; case "Belgium": { ?> [COLOR="Olive"]<-- GOOGLE ADSENSE OR WHATEVER CODE SUITABLE FOR BELGIUM GOES HERE -->[/COLOR] <? } break; [COLOR="DarkOrange"]// AND SO ON, YOU CAN ADD MORE COUNTRIES HERE JUST LIKE ABOVE[/COLOR] default: { [COLOR="DarkOrange"]// THIS WILL EXECUTE FOR [B]ALL[/B] OTHER DESTINATIONS NOT MENTIONED ABOVE[/COLOR] ?> [COLOR="Olive"]<-- GOOGLE ADSENSE OR WHATEVER CODE SUITABLE FOR OTHER DESTINATIONS -->[/COLOR] <? } } ?> Code (markup): And this is it! I'm not talking about this anymore.
Man, I can't thanks you enough for this awesome code I was searching for this code for days and almost given up. PS I need a few people who are living out side of the U.S. to check if you still see YPN ads on my site or not please http://www.tranix.net Appreciate a lot, Tranix
This is crazy for us to have to worry about international clicks. I have no control over this other than adding a script to help but thats not 100%. If Yahoo doesn't want foreign clicks they should have this built in to their script. Sorta sounds like a game.
Ok, let me get this more clearer for myself and others:- So, the first step is to download both of the files and upload to your directory where you are using. Then insert this code to whatever page you want to use:- <? // This part gets the ip of the visitor and matches it to a country name/code include("geoip.inc"); $gi = geoip_open("GeoIP.dat",GEOIP_STANDARD); $visitor_country_code=geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); $visitor_country_name=geoip_country_name_by_addr($gi, $_SERVER['REMOTE_ADDR']); //This part shows banners/codes that YOU decide for each country switch ($visitor_country_name) { case "USA": { ?> <script language="JavaScript"> <!-- ctxt_ad_partner = "xxxxxxxxxx"; ctxt_ad_section = ""; ctxt_ad_bg = ""; ctxt_ad_width = 250; ctxt_ad_height = 250; ctxt_ad_bc = "FFFFFF"; ctxt_ad_cc = "FFFFFF"; ctxt_ad_lc = "FFFFFF"; ctxt_ad_tc = "111111"; ctxt_ad_uc = "111111"; // --> </script> <script language="JavaScript" src="http://ypn-js.overture.com/partner/js/ypn.js"> </script> <? } break; // AND SO ON, YOU CAN ADD MORE COUNTRIES HERE JUST LIKE ABOVE default: { // THIS WILL EXECUTE FOR ALL OTHER DESTINATIONS NOT MENTIONED ABOVE ?> <script type="text/javascript"><!-- google_ad_client = "pub-xxxxxxxxxxxxx"; google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as"; google_ad_type = "text"; google_ad_channel =""; google_color_border = "FFFFFF"; google_color_bg = "FFFFFF"; google_color_link = "FFFFFF"; google_color_url = "FFFFFF"; google_color_text = "FFFFFF"; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <? } } ?> Code (markup): Correct me if i am wrong.
Exactly. Yahoo! should filter these out. It's obvious they already know where the clicks and views are coming from.
I am getting this error when trying to put two ad banners or ad sizes in one page:- Fatal error: Cannot redeclare class geoip in /home/thepath/public_html/thesite/contactus/geoip.inc on line 67 The first banner works fine but the second banner didn't Any help?
ummm... yeah, hold on you need to add this line at the end of the script above in order to be able to reopen geoipclass geoip_close($gi); Code (markup): or simply put it at the end of the file, and - for the second banner do not use the geoip_open line anymore. Only the SWITCH part should be repeated for each banner.. AND START LEARNING WEB PROGRAMMING!
Thanks a lot! i think i got this working, but is there anyway to check the ads with foreign i.p. address? Like any online web based proxy tools? using international i.p.? thanks.