Permalink
Browse files

Updated to print all of the PHP auto variables recursively

  • Loading branch information...
1 parent 6d6fa70 commit 200052d1ab5e8566d6b7bdfcf23c01d2cfbf5a5a Deepwinter committed Jul 13, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 restlog.php
View
@@ -1,9 +1,21 @@
<?php
+function foreachPrint($fh, $myArray){
+ foreach($myArray as $h=>$v){
+ fwrite($fh, "$h = $v\n");
+ if(is_array($v)){
+ foreachPrint($fh, $v);
+ }
+ }
+}
$myFile = "requestslog.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
fwrite($fh, "\n\n---------------------------------------------------------------\n");
foreach($_SERVER as $h=>$v)
fwrite($fh, "$h = $v\n");
+fwrite($fh, "REQUEST\n");
+foreachPrint($fh, $_REQUEST);
+fwrite($fh, "FILES\n");
+foreachPrint($fh, $_FILES);
fwrite($fh, "\r\n");
fwrite($fh, file_get_contents('php://input'));
fclose($fh);

0 comments on commit 200052d

Please sign in to comment.