24 lines
869 B
PHP
24 lines
869 B
PHP
<?php
|
|
include dirname(__FILE__).'/config/config.inc.php';
|
|
include dirname(__FILE__).'/init.php';
|
|
|
|
if(!$cookie->isLogged()) {
|
|
exit;
|
|
}
|
|
|
|
$token = Tools::getValue('token');
|
|
if($token && $token === Tools::encrypt(date('Y-m-d').$cookie->id_customer.'Wb62nI1mcPdwyqqt')) {
|
|
if((int) Tools::getValue('id_country') === 8) {
|
|
$postcode = Tools::getValue('postcode');
|
|
$city = Tools::getValue('city');
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
echo json_encode(Db::getInstance()->ExecuteS('
|
|
SELECT `city`, `postcode`
|
|
FROM `'._DB_PREFIX_.'france_postcode`
|
|
WHERE 1
|
|
'.($postcode? ' AND `postcode` LIKE "%'.pSQL($postcode).'%"': '').'
|
|
'.($city? ' AND `city` LIKE "%'.pSQL(preg_replace('/ C(I|E)DEX(.*)$/i', '', $city)).'%"': '').'
|
|
LIMIT 46
|
|
'));
|
|
}
|
|
} |