2018-03-30 19:28:22 +00:00
|
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Copyright (c) 2018.
|
|
|
|
|
* Author: Igor Barkov <lopar.4ever@gmail.com>
|
|
|
|
|
* Project name: Battles-Game
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class input
|
|
|
|
|
{
|
|
|
|
|
public static function get($name) {
|
2018-12-11 10:57:31 +00:00
|
|
|
|
$var = trim(filter_input(INPUT_GET,$name));
|
2018-12-11 09:23:51 +00:00
|
|
|
|
if (isset($var) AND !empty($var))
|
|
|
|
|
return $var;
|
|
|
|
|
else return null;
|
2018-03-30 19:28:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function post($name) {
|
2018-12-11 10:57:31 +00:00
|
|
|
|
$var = trim(filter_input(INPUT_POST,$name));
|
2018-12-11 09:23:51 +00:00
|
|
|
|
if (isset($var) AND !empty($var))
|
|
|
|
|
return $var;
|
|
|
|
|
else return null;
|
2018-03-30 19:28:22 +00:00
|
|
|
|
}
|
2019-06-20 21:48:46 +00:00
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
2018-03-30 19:28:22 +00:00
|
|
|
|
}
|