|
@@ -14,7 +14,8 @@ function ends_with($haystack, $needle)
|
14
|
14
|
|
15
|
15
|
function error($code, $message)
|
16
|
16
|
{
|
17
|
|
- header("HTTP/ $code $message");
|
|
17
|
+ http_response_code($code);
|
|
18
|
+ /* header("HTTP/ $code $message"); */
|
18
|
19
|
die(json_encode(array("code" => intval($code), "message" => $message)));
|
19
|
20
|
}
|
20
|
21
|
|
|
@@ -40,12 +41,12 @@ function get_get($key, $is_error = true)
|
40
|
41
|
|
41
|
42
|
function check_float($f, $def = null)
|
42
|
43
|
{
|
43
|
|
- return ($f == (string)(float)$f) ? $f : $def;
|
|
44
|
+ return is_numeric($f) ? $f : $def;
|
44
|
45
|
}
|
45
|
46
|
|
46
|
47
|
function check_int($i, $def = null)
|
47
|
48
|
{
|
48
|
|
- return is_numeric($i) ? $i : $def;
|
|
49
|
+ return is_numeric($i) && $i == (int)$i ? $i : $def;
|
49
|
50
|
}
|
50
|
51
|
|
51
|
52
|
function check_table_field($header, $table, $field)
|