guys unsaon pag block ang country ip sa imong website using PHP??
ug mga normal ip na pwde eh block sa php?
guys unsaon pag block ang country ip sa imong website using PHP??
ug mga normal ip na pwde eh block sa php?
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
<?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...
<?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;
?>
thats realy good help guys... thanks po..
Similar Threads |
|