intval($code), "message" => $message))); } function get_param($array, $key, $is_error) { if (isset($array[$key])) return $array[$key]; else if ($is_error) error(400, "Missing parameters"); else return false; } function get_post($key, $is_error = true) { return get_param($_POST, $key, $is_error); } function get_get($key, $is_error = true) { return get_param($_GET, $key, $is_error); } function check_table_field($header, $table, $field) { $headers = apache_request_headers(); if (!isset($headers[$header])) return false; $u = database_exec("SELECT id FROM $table WHERE `$field` = :data", array(":data" => $headers[$header]))->fetch(); if (!$u) return false; return $headers[$header]; } ?>