5

I want to restrict which country can access my webpage, but I can't get it to work.

I tried following this guide.

It gives me lots of error when it is hosted on my localhost (XAMPP). Check error from screenshot:

My Image

And if it is uploaded to some free hosting it gives me an infinite "LOOP" when accessing domain.com/index.php or domain.com/redirect.php.

But on this webpage it works, and shows my details perfectly (country, country code, latitude, longitude etc.)

I've pasted those two files on the same folder and trying it to access on my computer which is:

http://localhost/geoplugin.class/index.php

Drenmi
  • 8,492
  • 4
  • 42
  • 51
Jacob
  • 67
  • 2
  • Localhost cannot be used to test these redirections in primary. At the hosting, are you redirecting to the same page, or a page which also included this redirection code? – Perrykipkerrie Dec 21 '15 at 06:50
  • 3
    Post your code, please! – Amit Verma Dec 21 '15 at 06:51
  • My codes are which i did copy the tutorials from here: tutorial link kar.in/zu so i have 3 files: geoplugin.class.php index.php & redirect.php So if it does not work on localhost. Everytime I uploaded it on my free hosting it does loop and loop.. could u guys add me on skype though? – Jacob Dec 21 '15 at 07:24
  • Possible duplicate of [Reference - What does this error mean in PHP?](http://stackoverflow.com/questions/12769982/reference-what-does-this-error-mean-in-php) – Gerald Schneider Dec 21 '15 at 07:32

1 Answers1

0

Best way to do it ..Is to use .htaccess

Here is website that will generate htaccess country block codes:

http://www.ip2location.com/blockvisitorsbycountry.aspx

MrJack Mcfreder
  • 692
  • 1
  • 10
  • 21