<?php
///////////////////////////////////////////////////////////////////////////////////////////
///Script PHP/MYSQL of management of classifieds ads developed by Script PAG
///Script PAG all rights reserved. Use under license. http://www.script-pag.com
///////////////////////////////////////////////////////////////////////////////////////////

############################################################

require_once __DIR__.'/../all_fns.php';

pool::execute('beforestart');

///////////////////////////////////
//Save purchase billing information
//////////////////////////////////
if(!empty($_POST['id_purch']) && !empty($_POST['name']) && !empty($_POST['first_name']) && !empty($_POST['address']) && ($cache_param_fields['act_postcode'] == 0 || !empty($_POST['postcode'])) && ($cache_param_fields['act_city'] == 0 || !empty($_POST['city']))) {
	$conn = db_connect();
	if(save_purchase_billing($_POST)) {
		$response = $_POST;
	}
} else $response = false;

echo json_encode(array('status' => 200, 'response' => $response), JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);