<?php
// bigemail.php
// Check for POSTed data and data0
// RJM Programming
// November, 2015

function checkdatadata0($modeis, $thing) {
  if (strtoupper($modeis) == "POST") {
    if (strpos((urldecode($thing) . '~'), '.huh~') !== false) {
      if (file_exists(urldecode($thing))) {
        return file_get_contents(urldecode($thing));
      } else if (file_exists("../" . urldecode($thing))) {
        return file_get_contents("../" . urldecode($thing));
      }
    }
    if (strpos((($thing) . '~'), '.huh~') !== false) {
      if (file_exists(($thing))) {
        return file_get_contents(($thing));
      } else if (file_exists(("../" . $thing))) {
        return file_get_contents(("../" . $thing));
      }
    }
  } else {
    if (strpos((($thing) . '~'), '.huh~') !== false) {
      if (file_exists(($thing))) {
        return file_get_contents(($thing));
      } else if (file_exists(("../" . $thing))) {
        return file_get_contents(("../" . $thing));
      }
    }
    if (strpos((urldecode($thing) . '~'), '.huh~') !== false) {
      if (file_exists(urldecode($thing))) {
        return file_get_contents(urldecode($thing));
      } else if (file_exists("../" . urldecode($thing))) {
        return file_get_contents("../" . urldecode($thing));
      }
    }
  }
  return $thing;
}

?>
