if (empty($_SERVER) || empty($_SERVER['DOCUMENT_ROOT'])) { $api_dir = __DIR__.'/../../../roastmonday'; } else { $api_dir = $_SERVER['DOCUMENT_ROOT']; } if (empty($_SERVER) || empty($_SERVER['SERVER_NAME'])) { $api_dir = __DIR__.'/../../../roastmonday'; } else { switch ($_SERVER['SERVER_NAME']) { case 'localhost': $api_dir .= '/..'; break; case 'beta.wedro.online': $api_dir .= '/../../roastmonday'; break; default: $api_dir .= '/../roastmonday'; break; } } #echo "API DIR: ".$api_dir.PHP_EOL; $internal_pics_dir = __DIR__.'/'; $api_dir = realpath($api_dir).'/Roastmonday.php'; #echo "Real API file: ".$api_dir.PHP_EOL; require_once $api_dir; ?> function redirect($url) { header("Location: ".$url); echo ''; echo 'Redirecting to '.$url.''; } function startsWith($haystack, $needle) { $length = strlen($needle); return (mb_substr($haystack, 0, $length) === $needle); } function endsWith($haystack, $needle) { $length = strlen($needle); if ($length == 0) { return true; } return (mb_substr($haystack, -$length) === $needle); } ?>