| |||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| NamePros Regular | Redirect users by country Im wondering if a script exists that can detect the country of origin and redirect the user to another page of my site... example: All United States users go to /us All UK users go to /uk And so on ........ Thank you
__________________ :notme: |
| |
| | #2 (permalink) |
| NamePros Regular | You'll need a large IP database/array which are available usually for a fee. Then the rest is up to a simple PHP script. |
| |
| | #5 (permalink) |
| Eating Pie | Get a database from Download geoip.zip I uploaded the free database and scripts. Inside you will see the database file GeoIP.dat and a geoip.inc.php file. Create a new PHP file and insert the following code PHP Code: You can just forget the switch clause and just do a simple header("location: http://yoursite.com/$cc"); Which will redirect ALL visitors to there seperate sections. For a list of the countries CC below. Code: "AP", "EU", "AD", "AE", "AF", "AG", "AI", "AL", "AM", "AN", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BM", "BN", "BO", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "FX", "GA", "GB", "GD", "GE", "GF", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", "IO", "IQ", "IR", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "ST", "SV", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TM", "TN", "TO", "TP", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "YE", "YT", "CS", "ZA", "ZM", "ZR", "ZW", "A1", "A2", "O1"
__________________ I feel old. Last edited by iNod; 12-21-2006 at 09:46 PM. |
| |
| | #6 (permalink) | |
| NamePros Regular | Wow, thanks iNod I'll try it! But tell me, How can I do an If clause to all the users from countries that dont have a specific part on the website? something like: Code:
default:
header("location: world.php");
break;
Thank you! +Rep Oh, and please upload the file elsewhere .. I can't download it.. It just stays loading and loading! :\ Thanks again! Quote:
__________________ :notme: Last edited by w1ww; 12-22-2006 at 04:56 AM. | |
| |
| | #7 (permalink) |
| NamePros Member | its also helpful fro me
__________________ Msn Names Seo Msn Blocker Online Games Desi Forum Teen Chat Tech Blog Fun MSN Display Pictures Short jokes Urdu News Geo News |
| |
| | #8 (permalink) |
| Ultima Ratio Regum | You can also find a free (and pretty good) IP to country database here: http://ip-to-country.webhosting.info/node/view/6 There are also some examples in there how to use it..
__________________ |Internet, Games, Computer Talk|IP Whois + Geolocation|Geolocate your IP| |Dynamic Forum Sigs|2,900+ Free Flash Games| <meta name="Jedi Mind Trick" content="Buy my domains, you will!"> VoIPUSA.com-MyBlogging.com-ArrivingSoon.com-Nano.tv- Technology.ws-Ammo.us-Racing.cc-Privacy.ws |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| |