Hi People, need some help
Actually I wanna block an IP address from a certain country... I don't want them to access my home page which is index.php.... so I've included a file
"country-redirect.php" this file is placed at beginning of my index.php....
index.php code is like
<?php
require('country-redirect.php');
?>
<html>
....
....
<h1>ALLOWED</h1>
</html>
now the code in the file "country-redirect.php" will check for the IP address......... code is like ......
/* Some long code here.... and then */
if($country == 'PK')
{
header('Location: http://www.mysite.in/block.php');
}
else
{
header('Location: http://www.mysite.in/index.php');
}
Now the problem is PK people are getting blocked, that is fine......... but people from other countries say Japan... are directed to my home page which is index.php but index.php is again calling country-redirect.php because its initial code is
<?php
require('country-redirect.php');
?>
so its like going in a loop... redirect loop error like....
I mean chrome is giving me this error...
This webpage has a redirect loop
The webpage at http://www.mysite.in/a/index.php has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.