Thursday, July 04, 2013
How To Block (Ban / Restrict) Access To PHP Script Or Page? Yes, You Can Ban Everybody And Allow Only Your Website To Accessing The Page Of Your PHP Script

Did you search for a way, PHP script, just to restricting access of your php page? If that is it my friend, Well, you have come to the right place. Here i'll let you know Just how can you do that with ease using a short line of PHP code. The code is working, and it doesn't require you to know your ip address or some kind, doesn't even require you to learn PHP script, all you need to know is just the address, url of the page that you want to let it able to access the PHP page, and that is it.

Usually, those who need such a code are those who host own PHP script on a limited hosting. The problem doesn't come by the quota or bandwith given, cause generally, at its bad they have approximately 2GB bandwith per month, and that 2GB is not gonna be completely spent out in a month. The problem comes by "bad bots", which the bots are intentially sent by somebody to suck out the bandwith, somebody that might doesn't like those people.

Script Code For Restricting / Banning / Blocking Access To PHP Script Or Page

I've told you, the code is short and so very short. The only thing that you may want to know about the code, about the placement of the code, is that it must be placed on very top line before any other code written. If you put the code after or below the other one, the code may work only on those that are written below it.

The only problem with the code is that you can set only one website to include into the code, if you have two websites to include then you'll need to know about the "if" statement, if you have many websites to include then you'll need to find another way, the code that i'm about to tell here is not intended for such need.

Very well! Here is the code.

$block = getenv('HTTP_REFERER');
if (strpos($block, '') != 7) {die("Restricted Area: You got no permittion!"); }

That's it my friend, just replace my blog url with your and well done. There are still many ways that you can find to restrict access of your PHP page, if it's not what you want then just google out. If you take my code but then you face any trouble, then tell me about it and let me help you out.

The following are some posts in relation to PHP script. > Individual Or Single Page Counter / Post Counter Widget For Blogger > Daily Page / Post Counter For Blogger > Weekly Page / Post Counter For Blogger > Yearly Page / Post Counter Widget For Blogger > Best Free Web Hostings With PHP And MySQL Support


Post a Comment