Show blocked hosts on web

This script uses PHP and MySQL to create a web page that lists all the blocked hosts.

It uses a IP to country mapping table to show country flags.

To see this working visit tanchaz.hu/blockhosts/

That page also includes a link to download the software.

Comments

Max execution time exceeded

In that case you are experiencing a warning "max_execution_time exceeded", you may put a .htaccess file into your blockhosts folder with this content:

php_value max_execution_time 90

Fix scripts

Downloaded the blocked_hosts.zip file. First the php files need the ^M removed. Use the dos2unix command.
In order for me to get the index.php working with the BlockHosts-2.4.0, I did the following:
change line 4 from $file = "/etc/hosts.deny" to $file = "/etc/hosts.allow"
change line 6 from $blockline = "ALL" to $blockline = "deny"
Most importantly, the command on line 33 is not very good with splitting a string using only 1 whitespace character. Instead, change line 33 from $out[$i] = explode(" ",$output[$i]) to $out[$i] = preg_split('/\s+/',$output[$i])
This will split the array on any whitespace between characters and will file the table with ip addresses instead of blanks.
Finally in the file ip.class.php: be sure to make sure line 10 has the same file name for the iptocountry.csv as your file. I had to change it from ip2country.csv. Otherwise, the little flags will not show up.