Improve validation of incoming params

This commit is contained in:
Fedor A. Fetisov 2013-11-07 02:55:14 +04:00
parent 9f94e73dd2
commit 9a0c9f42a1

View File

@ -68,12 +68,12 @@ function myiconv($in_enc, $out_enc, $string)
function verifyparam($name, $regexp, $default = null)
{
if (isset($_GET[$name])) {
if (isset($_GET[$name]) && is_scalar($_GET[$name])) {
$val = $_GET[$name];
if (preg_match($regexp, $val))
return $val;
} else if (isset($_POST[$name])) {
} else if (isset($_POST[$name]) && is_scalar($_POST[$name])) {
$val = $_POST[$name];
if (preg_match($regexp, $val))
return $val;