Files
kupshop/web/ajax.php
2025-08-02 16:30:27 +02:00

42 lines
1.1 KiB
PHP

<?php
$type = !empty($_GET['type']) ? $_GET['type'] : null;
header('Content-type: application/json');
switch ($_GET['type']) {
case 'email':
if (!($email = getVal('email'))) {
exit;
}
$emailCheck = \KupShop\KupShopBundle\Util\Compat\ServiceContainer::getService(\KupShop\KupShopBundle\Util\Mail\EmailCheck::class);
$result = returnSQLResult('SELECT id FROM users WHERE email=:email AND figure = \'Y\'', ['email' => $email]);
echo json_encode(['found' => (bool) $result, 'validDomain' => $emailCheck->isEmailDomainValid($email)]);
exit;
case 'urgent_cargus_cities':
if (!($county = getVal('county'))) {
exit;
}
$urgentCargus = Delivery::getClass('UrgentCargus');
echo json_encode($urgentCargus->getCities($county));
exit;
case 'fan_courier_cities':
if (!($county = getVal('county'))) {
exit;
}
$fanCourier = Delivery::getClass('FANCourier');
echo json_encode($fanCourier->getCities($county));
exit;
default:
header('HTTP/1.0 404 Not Found');
exit;
}