Дополнительные проверки переменных

This commit is contained in:
Igor Barkov [iwork] 2018-12-11 11:23:51 +02:00
parent 2713745b62
commit cdd0028ecb

View File

@ -8,12 +8,16 @@
class input class input
{ {
public static function get($name) { public static function get($name) {
rtrim($_GET[$name]); $var = rtrim(filter_input(INPUT_GET,$name));
return (isset($_GET[$name]) AND !empty($_GET[$name])) ? $_GET[$name] : null; if (isset($var) AND !empty($var))
return $var;
else return null;
} }
public static function post($name) { public static function post($name) {
rtrim($_POST[$name]); $var = rtrim(filter_input(INPUT_POST,$name));
return (isset($_POST[$name]) AND !empty($_POST[$name])) ? $_POST[$name] : null; if (isset($var) AND !empty($var))
return $var;
else return null;
} }
} }