php: catch ajax request

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){
	
	getconnect($Ware_host, $Ware_user, $Ware_pswd, $Ware_database);
	$temp_detail = '';
	$temp_type = '';
	if($_POST['detail'])
		$temp_detail = addslashes($_POST['detail']);
	if($_POST['type'])
		$temp_type = $_POST['type'];
	if($temp_detail && $temp_type)
		mysql_query("INSERT INTO $hidden_expenses_details (detail,type) VALUES ('$temp_detail','$temp_type') ");
	die(1);
}