Files
anpdf/app/api/client.php

61 lines
1.1 KiB
PHP
Raw Normal View History

2020-04-28 21:16:20 +03:00
<?php
function api_client_kuri($hash){
$sql = "SELECT client_id FROM `clients` WHERE `clienthash` = '$hash' LIMIT 1 ";
$client = db_get($sql);
if (isset($client['client_id']))
return $client;
return false;
}
function clientbooks_kuri($client_id){
2020-04-29 15:01:25 +03:00
$buysql = "SELECT * FROM anbuy WHERE client_id = '$client_id' AND `buy_status` = '1'";
2020-04-28 21:16:20 +03:00
echo $buysql;
$buys = db_get($buysql);
2020-04-29 15:01:25 +03:00
2020-04-28 21:16:20 +03:00
return $buys;
}
//весь активный архив
2020-04-29 15:01:25 +03:00
function api_arch($page = 1){
2020-04-28 21:16:20 +03:00
$limit = 25;
/** $scount = "
SELECT COUNT(price.price_id) AS count
FROM price
WHERE category_id = 1
LIMIT 1";
$count = db_get($scount);*
*/
$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";
}
$items = db_get($pricesql);
foreach ($items as $item){
$item['pic'] = IMGSRV."price/180x280/{$item['price_id']}.{$item['priceimg']}";
$result[] = $item;
}
return $result;
}