Next Previous Contents

7. Block those countries

Now it's time to move on and get your web site setup so it can block the countries you don't want or don't need. There's nothing personal intended here, but there comes a time when we just can't take it anymore and must take some drastic action. It's just too bad that there are some bad people out there spoiling the internet for everyone else.

Some will say, "a few bad apples spoils it for everyone". Well, it's not a few bad apples. There are thousands if not millions of bad apples in this case. What do we do about them? BLOCK 'EM!

7.1 Pick your countries

Now you get to decide who you like and who you don't like. So, from the main menu at: on "Country Selections".

You'll get a page displayed showing some buttons and all the available countries you can pick from. The first time you run this program, none of the countries will be selected. This means that you are not choosing to block any country yet.

Go through the list and pick the countries you want to block. There is a checkbox next to each country name.

You'll notice 4 buttons displayed in a row. Here's the description of each one:

Clear All - clicking on this button will clear all the country selections. Use this button to clear all of your existing selections when you want to pick just one or two countries.

Select All - clicking on this button will select all of the countries. Use this and then deselect a country or two. You might want to block out the whole entire world all except for a few select countries.

Save As Defaults - when you are happy with your selections, click on this button to save your settings. Everytime you load this program, you'll have the same countries selected for further work.

Load Default Selections - click on this if you change your mind or need to revert back to your default country selections.

7.1 Build the "ht" files

Now that you have all of the countries selected that you want to block, it's time to build the files that are actually used by the countrycheck.php program. There will be 256 files with names beginning with "ht". They will be "ht0.php" through "ht255.php".

Click on "Begin" and all of the "htxxx.php" files will be created.

It doesn't take very long to create these files. Your web browser will wait until the job is finished. Don't hit the stop button, let it do it's job. On a fast server, it might only take 10 seconds or so. A slow server might take a couple of minutes. If something goes wrong, it's a simple matter of clicking on "Begin" to do it all over again. You don't have to delete any files that were already created, they will get replaced automatically.

NOTE: Even later on when this package is fully setup and running, you can add or remove countries without disturbing the functioning of your web site. You site will continue to run while doing this operation.

Each one of these "htxxx.php" files will contain 0 or more IP address ranges depending on the countries you have chosen to block. As an example, let's say you've decided to block all of China. (most people will want to block China!) The file "ht218.php" will contain some address ranges pertaining to China as well as possibly some from other countries you may have chosen. If a request for a file on your web site is made from the IP address, the countrycheck.php program will be used by the Apache web server to see if that address falls within a range of IP addresses listed in this file. If the address is found, the user will not be able to receive the file that was requested.

Next Previous Contents