Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function get_prf() {
- global $config;
- $db = new ods_db();
- $phone = $this->num;
- $filePath = __DIR__ . '/../../cities.txt';
- $cityIds = [];
- if (file_exists($filePath)) {
- $cityData = file_get_contents($filePath);
- $cityIds = $cityData ? explode(',', $cityData) : [];
- }
- if (!empty($cityIds)) {
- $placeholders = implode(',', array_fill(0, count($cityIds), '?'));
- } else {
- header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
- exit();
- }
- if($db->open()) {
- $sql = "SELECT * FROM Devices WHERE Phone = ? AND Town_id NOT IN ($placeholders) LIMIT 1";
- $statement = $db->db->prepare($sql);
- $params = array_merge([$phone], $cityIds);
- $statement->execute($params);
- $device = $statement->fetch();
- if ($device) {
- $prf = $this->dev_prf(isset($_GET['crc2']), isset($_GET['crc']));
- if ($prf['error'] === '') {
- $this->output($prf['str'], $this->num . '.pref.txt', isset($_GET['gz']));
- } else {
- header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
- exit();
- }
- } else {
- header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
- exit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement