Results 1 to 1 of 1

Thread: Block Countries with Geoip Lite (Easiest Way)

  1. #1
    ruben's Avatar
    ruben is offline Net Builder
    Join Date
    Oct 2009
    Blog Entries
    Thanked 57 Times in 48 Posts

    Wink Block Countries with Geoip Lite (Easiest Way)

    This tutorial is for PHProxy users (better than glype )
    note: this topic has been discussed again and again and again but i still find users having a hard time installing it so here goes my tutorial (works with shared hosting)
    1) Download

    2)Create a new folder called "geoip" in your phproxy main folder and paste and geoip.dat w/o cap locks inside the geoip folder.

    3)Paste this code in not index.php (people usually paste it in index.php but that can cause unexpected errors like corrupted images and random bugs)

    $gi = geoip_open('geoip/geoip.dat',GEOIP_STANDARD);
    $addr = getenv('REMOTE_ADDR');
    $country = geoip_country_name_by_addr($gi, $addr);
    $badcountry = array('Saudi Arabia','China','Iran','Brazil','Hungary','India','United Arab Emirates','Vietnam','Turkey','Pakistan','Israel','Indonesia','Iraq','Egypt');
    if(in_array($country, $badcountry))
    header('Location: http://YOUR-SITE-GOES-HERE/403.php'); //enter an url or page on your site
    and create a costume 403 error.

    And you are done

  2. Thanked by:

    Glypus (6 October, 2009), Greyhound (4 December, 2009), Will.Spencer (6 October, 2009)

Similar Threads

  1. How to install GeoIP and block foreign traffic
    By Will.Spencer in forum Web Proxies
    Replies: 3
    Last Post: 6 December, 2009, 04:35 AM
  2. How to block certain countries
    By Newbie191 in forum Web Proxies
    Replies: 5
    Last Post: 1 December, 2009, 16:11 PM
  3. Proxy Sites - Adsense - Countries To Block ??
    By Soulzripper in forum AdSense
    Replies: 17
    Last Post: 20 October, 2009, 14:20 PM
  4. GeoIP tutorial - block countries..etc
    By Keldorn in forum Programming
    Replies: 0
    Last Post: 22 September, 2009, 09:58 AM
  5. Which way is easiest for PR3?
    By SeoHawk in forum Promoting
    Replies: 0
    Last Post: 27 June, 2009, 13:22 PM

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts