checks and tests

This commit is contained in:
lopar
2019-06-21 00:48:46 +03:00
parent adf8db8f02
commit 6b7d01b507
2 changed files with 78 additions and 74 deletions

View File

@@ -20,4 +20,12 @@ class input
return $var;
else return null;
}
public static function check($name) {
# Срезаем с значения переменной табы, пробелы, другие невидимые символы по краям.
# Проверяем, что у переменной точно есть значение.
if (!empty(trim(filter_input(INPUT_GET,$name)))) return trim(filter_input(INPUT_GET,$name));
if (!empty(trim(filter_input(INPUT_POST,$name)))) return trim(filter_input(INPUT_POST,$name));
return null;
}
}