mirror of
https://github.com/Mibew/mibew.git
synced 2025-04-28 17:16:41 +03:00
Improve validation of incoming params
This commit is contained in:
parent
62bb63242b
commit
a749b8c000
@ -17,12 +17,12 @@
|
|||||||
|
|
||||||
function verifyparam($name, $regexp, $default = null)
|
function verifyparam($name, $regexp, $default = null)
|
||||||
{
|
{
|
||||||
if (isset($_GET[$name])) {
|
if (isset($_GET[$name]) && is_scalar($_GET[$name])) {
|
||||||
$val = $_GET[$name];
|
$val = $_GET[$name];
|
||||||
if (preg_match($regexp, $val))
|
if (preg_match($regexp, $val))
|
||||||
return $val;
|
return $val;
|
||||||
|
|
||||||
} else if (isset($_POST[$name])) {
|
} else if (isset($_POST[$name]) && is_scalar($_POST[$name])) {
|
||||||
$val = $_POST[$name];
|
$val = $_POST[$name];
|
||||||
if (preg_match($regexp, $val))
|
if (preg_match($regexp, $val))
|
||||||
return $val;
|
return $val;
|
||||||
|
Loading…
Reference in New Issue
Block a user