![]() |
|
|
|
||||||||||
![]() |
|
|
Thread Tools |
|
#21
|
|||
|
|||
|
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
|
|
#22
|
||||
|
||||
|
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
__________________
| | | |
|
#23
|
|||
|
|||
|
alright well I guess i'll just continue to wait for someone to post some code that actually works for us newbies. peace
|
|
#24
|
||||
|
||||
|
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!
__________________
| | | |
|
#25
|
||||
|
||||
|
Quote:
.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 Quote:
Tranix |
|
#26
|
||||
|
||||
|
Could you be more specific with the question, 'coz I don't get what you want. You've already done most of the work.
__________________
| | | |
|
#27
|
||||
|
||||
|
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']); ?>
Last edited by Tranix; Feb 4th 2006 at 1:47 pm. |
|
#28
|
||||
|
||||
|
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
__________________
| | | |
|
#29
|
||||
|
||||
|
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 Code:
<?
// 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 "Australia": { ?>
<-- GOOGLE ADSENSE OR WHATEVER CODE SUITABLE FOR AUSTRALIA GOES HERE -->
<? }
break;
case "Belgium": { ?>
<-- GOOGLE ADSENSE OR WHATEVER CODE SUITABLE FOR BELGIUM GOES HERE -->
<? }
break;
// AND SO ON, YOU CAN ADD MORE COUNTRIES HERE JUST LIKE ABOVE
default: { // THIS WILL EXECUTE FOR ALL OTHER DESTINATIONS NOT MENTIONED ABOVE ?>
<-- GOOGLE ADSENSE OR WHATEVER CODE SUITABLE FOR OTHER DESTINATIONS -->
<? }
}
?>
__________________
| | | |
|
#30
|
||||
|
||||
|
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 |
|
#31
|
||||
|
||||
|
I can see only one banner ad at the bottom
__________________
| | | |
|
#32
|
|||
|
|||
|
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. |
|
#33
|
||||
|
||||
|
Quote:
__________________
| | | |
|
#34
|
||||
|
||||
|
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:- Code:
<?
// 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>
<? }
}
?>
|
|
#35
|
||||
|
||||
|
I think you should spell out the country name USA => United Stats
|
|
#36
|
||||
|
||||
|
Quote:
|
|
#37
|
||||
|
||||
|
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? |
|
#38
|
||||
|
||||
|
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 Code:
geoip_close($gi); 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!
__________________
| | | |
|
#39
|
||||
|
||||
|
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. |
|
#40
|
|||
|
|||
|
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Geo Targeting | digitalpoint | General Marketing | 11 | Oct 22nd 2006 3:17 am |
| Geo targeting | cornelius | Programming | 2 | Dec 11th 2005 3:41 pm |
| Geo targeting questions | emotif | AdSense | 6 | Oct 27th 2005 6:35 am |
| Geo-targeting tool | cashbackers | All Other Tools | 1 | Jul 28th 2005 9:35 am |
| Geo Targeting | dcristo | Affiliate Programs | 4 | Jun 29th 2005 8:31 pm |