From 0e9d556a1c497f9f3bf52e710447541325d69ec6 Mon Sep 17 00:00:00 2001 From: Tom Schaefer Date: Sun, 25 Jul 2010 15:20:41 -0400 Subject: countryblock - adding two missing files --- config/countryblock/purge.tmp | 26 +++++ config/countryblock/whitelist.tmp | 213 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+) create mode 100644 config/countryblock/purge.tmp create mode 100644 config/countryblock/whitelist.tmp (limited to 'config') diff --git a/config/countryblock/purge.tmp b/config/countryblock/purge.tmp new file mode 100644 index 00000000..81d16a7c --- /dev/null +++ b/config/countryblock/purge.tmp @@ -0,0 +1,26 @@ + temp_lists.txt"); +if ($line == 0) { + exec("rm countries-white.txt"); + } else { + exec("sed $line'd' countries-white.txt > temp_countries-white.txt"); + } +exec("more temp_countries-white.txt > countries-white.txt"); +exec("rm temp_countries-white.txt"); + + +?> + + + + + + + \ No newline at end of file diff --git a/config/countryblock/whitelist.tmp b/config/countryblock/whitelist.tmp new file mode 100644 index 00000000..46e26608 --- /dev/null +++ b/config/countryblock/whitelist.tmp @@ -0,0 +1,213 @@ + + + + + + + + +

Firewall: Country Block - Whitelist

+
+ + + + + + + + + + + + + +

+ + + + + + +
+ Manual + + +
+

+ Enter the CIDR Range you would like to whitlist

+

+ + +Purge All + + + + + sizeof($arr)) + { + // print an error + print "You have chosen a line number, [$lineNum], higher than the length of the file."; + // exit the function + exit; + } + + //remove the line + unset($arr["$lineToDelete"]); + + // open the file for reading + if (!$fp = fopen($fileName, 'w+')) + { + // print an error + print "Cannot open file ($fileName)"; + // exit the function + exit; + } + + // if $fp is valid + if($fp) + { + // write the array to the file + foreach($arr as $line) { fwrite($fp,$line); } + + // close the file + fclose($fp); + } + +echo "done"; +} + + +$myFile = "countries-white.txt"; +$content = $_REQUEST['content']; +$fh = fopen($myFile, 'a+'); +fwrite($fh, $content); +if (strlen($content) > 1) { + fwrite($fh, "\n"); + } else { +} +fclose($fh); + + +//echo (filesize($myFile)); +if (filesize($myFile) > 1) { + //$fh = fopen($myFile, 'r'); + //$theData = fread($fh, filesize($myFile)); + //fclose($fh); + echo "
Current List(s):
"; + // Get the whole file into a single string + $fileContents = file_get_contents($myFile); + + // Explode the file contents string by each line + $lines = explode(PHP_EOL, $fileContents); // Replace PHP_EOL with "\r\n" or "\n" or "\r" if you like + + // Iterate through each line and do what you need with it + + foreach ($lines as $line) { + $i++; + echo ""; + echo " "; + echo $line; + //echo ""; + // echo $i; + echo "
"; + + } + + + //echo $theData; + + +} +echo "

"; + + + + +?>

+ +

Usage +
+ Enter a CIDR range for the Address you wish to whitlist.
+ Example: 192.168.1.0/24 +

+

+
+
+ +
+ + + + + + \ No newline at end of file -- cgit v1.2.3