//sanitize and return url vars function get($fields) { if(is_array($fields)) { $info = array(); foreach($fields as $field) { if(get($field) !== false) { $info[$field] = get($field); } } return $info; } else { //Single Value $field = $fields; if(isset($_POST[$field])) { return trim(addslashes(strip_tags($_POST[$field]))); } } return false; }
function json_header() { header("Expires:" . gmdate( "D, d M Y H:i:s", strtotime("+2 minutes")) . "GMT"); header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT"); header("Cache-Control: no-cache, must-revalidate" ); header("Pragma: no-cache" ); header("Content-type: application/json"); }