<?php

// Writes a string to a file optional with or without linefeed
function writeToFile($fileName, $stringToOperate, $mode = 'a', $noLf = "") {
  $fileHandle = fopen($fileName, $mode);
  if ($noLf == "") : $stringToOperate .= "\n"; endif;
  $opCode = fwrite($fileHandle, $stringToOperate);
  fclose($fileHandle);
  return $opCode;
}

?>

<html>
<!-- form id="uploader" action="https://172.16.0.147/test_php7_sb/sysadmin/uploader/uploader_ALL.php" method="post" -->
<form id="uploader" action="https://mps2.assecutor.de/uploader/uploader_ALL_REDIRECT_RECEIVER.php" method="post">
<?php
  $debug = true;
  if ($debug) :
     // print_r($_POST);
     $currentTime = date("Y-m-d H:i:s");
     writeToFile("uploader_post.log", "[" . $currentTime . " | " . trim($_SERVER['HTTP_X_FORWARDED_FOR']) . "]");
  endif;

  echo '<input type="hidden" name="clientIP" value="'. trim($_SERVER['HTTP_X_FORWARDED_FOR']) .'">';
  foreach ($_POST as $key => $val) {
    // echo '<input type="hidden" name="'.htmlentities($key).'" value="'.htmlentities($val).'">';
    echo '<input type="hidden" name="' . $key . '" value="'. $val .'">';
  }
?>
</form>
<script type="text/javascript">
    document.getElementById('uploader').submit();
</script>
</html>