diff options
Diffstat (limited to 'config/ipblocklist/ipblocklist_list.tmp')
-rw-r--r--[-rwxr-xr-x] | config/ipblocklist/ipblocklist_list.tmp | 226 |
1 files changed, 112 insertions, 114 deletions
diff --git a/config/ipblocklist/ipblocklist_list.tmp b/config/ipblocklist/ipblocklist_list.tmp index d1b3cf8a..2ea5a68b 100755..100644 --- a/config/ipblocklist/ipblocklist_list.tmp +++ b/config/ipblocklist/ipblocklist_list.tmp @@ -1,115 +1,113 @@ -<html> -<head> -<a href="whitelist.php"><img src="../../themes/nervecenter/images/icons/icon_plus.gif" ALT="Whitelist" ALIGN=RIGHT></a> -Add List URL: <form method="post" action=""> -<input name="content" type="text" /> -<input type="image" src="../../themes/nervecenter/images/icons/icon_plus.gif" value="submit"> -<a href="purge.php?line=0">Purge All</a> - -<STYLE type="text/css"> - a img {border:none; } - </STYLE> -</head> - -<?php - -function delLineFromFile($fileName, $lineNum){ -// check the file exists - if(!is_writable($fileName)) - { - // print an error - print "The file $fileName is not writable"; - // exit the function - exit; - } - else - { - // read the file into an array - $arr = file($fileName); - } - - // the line to delete is the line number minus 1, because arrays begin at zero - $lineToDelete = $lineNum-1; - - // check if the line to delete is greater than the length of the file - if($lineToDelete > sizeof($arr)) - { - // print an error - print "You have chosen a line number, <b>[$lineNum]</b>, 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 = "lists.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 "<br/> Current List(s): <br/>"; - // 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 "<a href=purge.php?line=$i style='border-style: none'><img src='../../themes/nervecenter/images/icons/icon_x.gif'></a>"; - echo " "; - echo $line; - //echo ""; - // echo $i; - echo "<br/>"; - - } - - - //echo $theData; - - -} -echo "<br/><br/>"; - - - - +<?php
+header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
+header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
+
+echo "<a href=\"whitelist.php\"><img src=\"../../themes/nervecenter/images/icons/icon_plus.gif\" ALT=\"Whitelist\" ALIGN=RIGHT></a>\n";
+echo "Add List URL: <form method=\"post\" action=\"\">\n";
+echo "<input name=\"content\" type=\"text\" />\n";
+echo "<input type=\"image\" src=\"../../themes/nervecenter/images/icons/icon_plus.gif\" value=\"submit\">\n";
+echo "<a href=\"purge.php?line=0\">Purge All</a>\n";
+echo "<STYLE type=\"text/css\">\n";
+echo " a img {border:none; }\n";
+echo " </STYLE>\n";
+
+function delLineFromFile($fileName, $lineNum){
+// check the file exists
+ if(!is_writable($fileName))
+ {
+ // print an error
+ print "The file $fileName is not writable";
+ // exit the function
+ exit;
+ }
+ else
+ {
+ // read the file into an array
+ $arr = file($fileName);
+ }
+
+ // the line to delete is the line number minus 1, because arrays begin at zero
+ $lineToDelete = $lineNum-1;
+
+ // check if the line to delete is greater than the length of the file
+ if($lineToDelete > sizeof($arr))
+ {
+ // print an error
+ print "You have chosen a line number, <b>[$lineNum]</b>, 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 = "lists.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 "<br/> Current List(s): <br/>";
+ // 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 "<a href=purge.php?line=$i style='border-style: none'><img src='../../themes/nervecenter/images/icons/icon_x.gif'></a>";
+ echo " ";
+ echo $line;
+ //echo "";
+ // echo $i;
+ echo "<br/>";
+
+ }
+
+
+ //echo $theData;
+
+
+}
+echo "<br/><br/>";
+
+
+
+
?>
\ No newline at end of file |