1
0
www.mikescher.com/www/internals/base.php
2017-12-30 23:46:27 +01:00

28 lines
647 B
PHP

<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
global $CONFIG;
$CONFIG = require 'config.php';
function startsWith($haystack, $needle)
{
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
function endsWith($haystack, $needle)
{
$length = strlen($needle);
return $length === 0 || (substr($haystack, -$length) === $needle);
}
function httpError($errorcode, $message)
{
die($message);//TODO errorcode
}
function destructiveUrlEncode($str) {
$str = str_replace(' ', '_', $str);
$str = str_replace('+', '_', $str);
$str = str_replace('.', '', $str);
return urlencode($str);
}