Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function check_device_in_allowed_city($phone) {
- $filePath = __DIR__ . '/../../cities.txt';
- $cityIds = [];
- if (file_exists($filePath)) {
- $cityData = file_get_contents($filePath);
- $cityIds = $cityData ? explode(',', $cityData) : [];
- }
- if (empty($cityIds)) {
- return true;
- }
- $db = new ods_db();
- if($db->open()) {
- $sql = "SELECT * FROM Devices WHERE Phone = ? AND Town_id NOT IN (" . implode(',', array_fill(0, count($cityIds), '?')) . ") LIMIT 1";
- $stmt = $db->db->prepare($sql);
- $params = array_merge([$phone], $cityIds);
- $stmt->execute($params);
- $device = $stmt->fetch();
- return (bool)$device;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement