From 2519ce2f01e42918638b6daf532b20511c8e82f2 Mon Sep 17 00:00:00 2001 From: Andrey Kuvshinov Date: Fri, 29 May 2020 21:29:27 +0300 Subject: [PATCH] find mail in buys --- app/api/apiclient.php | 6 +++--- app/routes/auth.php | 7 ++++++- app/routes/client.php | 22 ++++++---------------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/app/api/apiclient.php b/app/api/apiclient.php index 07b4ba6..cea7032 100644 --- a/app/api/apiclient.php +++ b/app/api/apiclient.php @@ -2,7 +2,7 @@ function api_client_kuri($hash){ - $sql = "SELECT client_id, clientgroup_id FROM `clients` WHERE `clienthash` = '$hash' LIMIT 1 "; + $sql = "SELECT client_id, clientgroup_id, clientmail FROM `clients` WHERE `clienthash` = '$hash' LIMIT 1 "; $client = db_get($sql); if (isset($client['client_id'])) @@ -32,13 +32,13 @@ function api_login($login, $password){ } -function clientbuys_kuri($client_id, $page = 1, $category_id = 1, $group_id = null, $filter = null){ +function clientbuys_kuri($client_mail, $page = 1, $category_id = 1, $group_id = null, $filter = null){ if ($group_id == 1 or $group_id == 2){ return clients_arch($page, $category_id, $filter); } - $sql_sub = "SELECT number_id FROM anbuy WHERE client_id = '$client_id' AND `number_id` = 486 AND `buy_status` = '1' LIMIT 1"; //есть ли активная подписка + $sql_sub = "SELECT number_id FROM `anbuy` WHERE buy_email = '$client_mail' AND `number_id` = 486 AND `buy_status` = '1' LIMIT 1"; //есть ли активная подписка $findsub = db_get($sql_sub); diff --git a/app/routes/auth.php b/app/routes/auth.php index 3154611..f077f76 100644 --- a/app/routes/auth.php +++ b/app/routes/auth.php @@ -97,10 +97,15 @@ function test_client_hash_kuri($hash){ $client = client_find_hash($hash); - if (isset($client['error'])) { + print_r($client); + + if (!isset($client['error'])) { out_kuri(); add_user_cookie($client['client_id'],$client['clientpassword']); } + exit; + + return; } diff --git a/app/routes/client.php b/app/routes/client.php index 8c2b8c4..ac6ba89 100644 --- a/app/routes/client.php +++ b/app/routes/client.php @@ -80,6 +80,10 @@ function addcard($id, $date) { } + + + + function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){ $login = check_login_kuri(); @@ -104,7 +108,8 @@ function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){ return; } - $items = clientbuys_kuri($client['client_id'], $page, $category_id, $client['clientgroup_id'], $filter); + $items = clientbuys_kuri($client['clientmail'], $page, $category_id, $client['clientgroup_id'], $filter); + $count = $items['count']; if ($count > $limit){ @@ -136,21 +141,6 @@ function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){ -function books_client_kuri($id){ - - $login = check_login_kuri(); - - - if (!isset($login['client_id'])){ - header('Location: '.SITE.'login'); - exit; - } - - - - - -}