Results 1 to 5 of 5
  1. #1

    Default how to block country ip


    guys unsaon pag block ang country ip sa imong website using PHP??

    ug mga normal ip na pwde eh block sa php?

  2. #2

    Default Re: how to block country ip

    try daw ni TS:

    <?
    $banned[0]="xxx.xxx.xxx.xxx"; // IP in the form of "127.0.0.1" or whatever
    $banned[1]="yyy.yyy.yyy.yyy";
    $banned[2]="zzz.zzz.zzz.zzz";

    // add as many as you wish

    if (in_array($_SERVER['REMOTE_ADDR'],$banned)) header("HTTP/1.1 403 Forbidden");
    ?>


    ^^.u

  3. #3

    Default Re: how to block country ip

    <?php
    $deny = array("111.111.111", "222.222.222", "333.333.333");
    if (in_array ($_SERVER['REMOTE_ADDR'], $deny)) {
    header("location: http://www.google.com/");
    exit();
    } ?>

    try pud ni siya brod...

  4. #4

    Default Re: how to block country ip

    <?php
    # array of country codes you wanna block
    $block_countries = array(
    'GB',
    'US'
    );
    # grab the country code from krakjoe.com
    if( !in_array( file_get_contents( 'http://krakjoe.com/geoip/query=code&address=remote' ), $block_countries ) ) :
    # the following page will only be displayed to users who have a country code that is NOT in the array at the top of the example
    ?>
    <html>
    <head>
    <title>You're allowed to view this page</title>
    </head>
    <body>
    viewing the page, oh yeah baby .....
    </body>
    </html>
    <?php
    endif;
    ?>

  5. #5

    Default Re: how to block country ip

    thats realy good help guys... thanks po..

  6.    Advertisement

Similar Threads

 
  1. how to block stolen phones?
    By HOTspot in forum General Gizmos & Gadgets Discussion
    Replies: 27
    Last Post: 03-13-2012, 09:40 AM
  2. how to block ping request through my global IP?
    By dammy in forum Networking & Internet
    Replies: 9
    Last Post: 05-05-2010, 02:29 AM
  3. HOW TO BLOCK YAHOO MESSENGER?
    By vrad03 in forum Networking & Internet
    Replies: 31
    Last Post: 09-26-2006, 08:45 AM
  4. How to block sites using no www. prefix instead http://
    By Freeza in forum Networking & Internet
    Replies: 17
    Last Post: 07-21-2006, 09:19 PM
  5. how to block internet conection?
    By etgo in forum Networking & Internet
    Replies: 21
    Last Post: 05-22-2006, 09:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top