1){ $offset = $limit * ($page -1); $pricesql .= " OFFSET $offset"; } $books = db_get($buysql); $result['books'] = clientbooks($books, $client_id); $result['count'] = $buycount['count']; return $result; } function clientmail($mail, $hash){ $client = db_get("SELECT * FROM `clients` WHERE `clientmail` = $mail LIMIT 1"); if (!isset($client['client_id'])){ echo 'Не верный запрос'; return; } if ($client['clienthash'] !== $hash){ echo 'Не верный запрос'; return; } } //весь активный архив function clients_arch($page = 1){ $limit = 25; $countsql = "SELECT COUNT(price_id) AS count FROM price WHERE category_id = 1 LIMIT 1"; $count = db_get($countsql); $pricesql = "SELECT price_id, pricehash, pricename, priceimg FROM price WHERE category_id = 1 ORDER BY price_id DESC LIMIT $limit"; if ($page > 1){ $offset = $limit * ($page -1); $pricesql .= " OFFSET $offset"; } $books = db_get($pricesql); $result['books'] = clientbooks($books, $clienthash); $result['subscript'] = true; $result['count'] = $count['count']; return $result; } function clientbooks($books, $clienthash){ if (!is_array($books)) return null; foreach($books as $book){ $book['pic'] = IMGSRV."price/180x280/{$book['price_id']}.{$book['priceimg']}"; $book['link'] = 'read/'.$clienthash; $result[] = $book; } return $result; }