2011-06-02 00:48:29 +02:00
|
|
|
<?php
|
2011-06-02 23:41:50 +02:00
|
|
|
|
2011-12-21 22:20:06 +01:00
|
|
|
/**
|
|
|
|
* Leitet den Browser an die übergebene URL weiter und hält das Script an.
|
|
|
|
*/
|
|
|
|
function redirect($to) {
|
2013-10-13 00:52:44 +02:00
|
|
|
header("Location: " . $to, true, 302);
|
|
|
|
die();
|
2011-12-21 22:20:06 +01:00
|
|
|
}
|
|
|
|
|
2016-08-21 22:58:09 +02:00
|
|
|
/**
|
|
|
|
* Echoes given output and dies.
|
|
|
|
*
|
|
|
|
* @param String $output
|
|
|
|
*/
|
|
|
|
function raw_output($output) {
|
|
|
|
echo $output;
|
|
|
|
die();
|
|
|
|
}
|
|
|
|
|
2011-12-21 22:20:06 +01:00
|
|
|
/**
|
|
|
|
* Gibt den gefilterten REQUEST Wert ohne Zeilenumbrüche zurück
|
|
|
|
*/
|
2011-06-02 23:41:50 +02:00
|
|
|
function strip_request_item($name) {
|
2013-10-13 00:52:44 +02:00
|
|
|
return strip_item($_REQUEST[$name]);
|
2011-06-02 23:41:50 +02:00
|
|
|
}
|
|
|
|
|
2011-12-21 22:20:06 +01:00
|
|
|
/**
|
2013-10-13 00:52:44 +02:00
|
|
|
* Testet, ob der angegebene REQUEST Wert ein Integer ist, bzw.
|
|
|
|
* eine ID sein könnte.
|
2011-12-21 22:20:06 +01:00
|
|
|
*/
|
|
|
|
function test_request_int($name) {
|
2013-10-13 00:52:44 +02:00
|
|
|
if (isset($_REQUEST[$name]))
|
|
|
|
return preg_match("/^[0-9]*$/", $_REQUEST[$name]);
|
|
|
|
return false;
|
2011-12-21 22:20:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gibt den gefilterten REQUEST Wert mit Zeilenumbrüchen zurück
|
|
|
|
*/
|
2011-06-03 11:09:25 +02:00
|
|
|
function strip_request_item_nl($name) {
|
2013-10-13 00:52:44 +02:00
|
|
|
return preg_replace("/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+\n]{1,})/ui", '', strip_tags($_REQUEST[$name]));
|
2011-12-21 22:20:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Entfernt unerwünschte Zeichen
|
|
|
|
*/
|
|
|
|
function strip_item($item) {
|
2013-10-13 00:52:44 +02:00
|
|
|
return preg_replace("/([^\p{L}\p{S}\p{P}\p{Z}\p{N}+]{1,})/ui", '', strip_tags($item));
|
2011-12-21 22:20:06 +01:00
|
|
|
}
|
|
|
|
|
2011-12-26 15:55:17 +01:00
|
|
|
/**
|
|
|
|
* Überprüft eine E-Mail-Adresse.
|
|
|
|
*/
|
|
|
|
function check_email($email) {
|
2015-08-26 15:19:22 +02:00
|
|
|
return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
|
2011-12-26 15:55:17 +01:00
|
|
|
}
|
|
|
|
|
2011-06-02 23:41:50 +02:00
|
|
|
?>
|