X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fdata_checks.inc;h=89d57d6345db521c90d791c8d30f9fdb3c9511cc;hb=193f28f3518aae0fbf3b0ce523a5ac13dc8074f4;hp=ef33acfdfd4d329412a7461586c07488f20b526a;hpb=9ad27981afdaa91591f4e71d19ac59653c524cea;p=fa-stable.git diff --git a/includes/data_checks.inc b/includes/data_checks.inc index ef33acfd..89d57d63 100644 --- a/includes/data_checks.inc +++ b/includes/data_checks.inc @@ -1,5 +1,4 @@ 0; } +// +// Integer input check +// Return 1 if number has proper form and is within range +// +function check_int($postname, $min=null, $max=null) { + if(!isset($_POST[$postname])) + return 0; + $num = input_num($postname); + if(!is_int($num)) + return 0; + if (isset($min) && ($num<$min)) + return 0; + if (isset($max) && ($num>$max)) + return 0; + return 1; +} +// +// Numeric input check. +// Return 1 if number has proper form and is within range +// +function check_num($postname, $min=null, $max=null) { + if(!isset($_POST[$postname])) + return 0; + $num = input_num($postname); + if ($num === false) + return 0; + if (isset($min) && ($num<$min)) + return 0; + if (isset($max) && ($num>$max)) + return 0; + return 1; +} + ?> \ No newline at end of file