+//
+// Integer input check
+// Return 1 if number has proper form and is within <min, max> 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 <min, max> 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;
+}
+