find mail in buys

This commit is contained in:
Andrey Kuvshinov
2020-05-29 21:29:27 +03:00
parent 621dea28bd
commit 2519ce2f01
3 changed files with 15 additions and 20 deletions

View File

@@ -2,7 +2,7 @@
function api_client_kuri($hash){ 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); $client = db_get($sql);
if (isset($client['client_id'])) 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){ if ($group_id == 1 or $group_id == 2){
return clients_arch($page, $category_id, $filter); 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); $findsub = db_get($sql_sub);

View File

@@ -97,10 +97,15 @@ function test_client_hash_kuri($hash){
$client = client_find_hash($hash); $client = client_find_hash($hash);
if (isset($client['error'])) { print_r($client);
if (!isset($client['error'])) {
out_kuri(); out_kuri();
add_user_cookie($client['client_id'],$client['clientpassword']); add_user_cookie($client['client_id'],$client['clientpassword']);
} }
exit;
return;
} }

View File

@@ -80,6 +80,10 @@ function addcard($id, $date) {
} }
function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){ function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){
$login = check_login_kuri(); $login = check_login_kuri();
@@ -104,7 +108,8 @@ function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){
return; 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']; $count = $items['count'];
if ($count > $limit){ 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;
}
}