This commit is contained in:
Your Name
2020-07-03 14:29:46 +03:00
parent 6f82be0ef9
commit 347c9bddb0
5 changed files with 98 additions and 75 deletions

View File

@@ -11,16 +11,16 @@ function addclient(){
$clientdate = date('Y-m-d G:i:s');
else
$clientdate = $buy['date_start'];
$clientmail = strtolower(trim($buy['buy_email']));
$clientmail = strtolower(trim($buy['buy_email']));
$clienthash = md5($clientmail);
$client = db_get("SELECT `client_id`, `clientcard`, `clientdate` FROM `clients` WHERE `clientmail` = '$clientmail' LIMIT 1");
if (isset($client['client_id'])){
if ($client['clientdate'] == '0000-00-00 00:00:00'){
$updsql = "UPDATE `clients` SET `clientdate` = '$clientdate' WHERE `client_id` = '{$client['client_id']}'";
db_get($updsql, 'writer');
@@ -41,12 +41,12 @@ function addclient(){
}
else {
$inssql = "INSERT INTO `clients` (clientmail, clientdate, clienthash) VALUES ('$clientmail', '$clientdate', '$clienthash')";
db_get($inssql, 'writer');
echo "$inssql \n";
}
}
}
}
@@ -56,15 +56,15 @@ function addclientid(){
$buys = db_get("SELECT `buy_id`, `buy_email` FROM `anbuy` WHERE `client_id` = 0");
foreach ($buys as $buy){
$clientmail = strtolower(trim($buy['buy_email']));
$clientmail = strtolower(trim($buy['buy_email']));
$client = db_get("SELECT `client_id` FROM `clients` WHERE `clientmail` = '$clientmail' LIMIT 1");
if (isset($client['client_id'])){
$updsql = "UPDATE `anbuy` SET `client_id` = '{$client['client_id']}' WHERE `buy_id` = '{$buy['buy_id']}'";
echo "$updsql\n";
db_get($updsql);
}
}
}
}
}
@@ -85,13 +85,13 @@ function restoration_kuri(){
if (isset($_POST['reset_mail'])){
$email = $_POST['reset_mail'];
$title = 'Восстановление пароля';
$hash = api_restore_mail($mail);
if ($hash !== false) {
$hashlink = SITE.'resetlink/'.$hash;
}
}
echo $hashlink;
$tempcontent = VIEWPATH.'restore_add.phtml';
@@ -113,13 +113,13 @@ function resetlink_kuri($hash){
$res = api_restore_hash($hash);
if (!$res){
}
else {
header("HTTP/1.1 301 Moved Permanently");
else {
header("HTTP/1.1 301 Moved Permanently");
header("Location: ${SITE}/resetpwd/"); exit();
}
}
@@ -138,8 +138,8 @@ function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){
if ($category == 'gazeta')
$category_id = 1;
elseif ($category == 'books')
$category_id = 3;
$category_id = 3;
$limit = 25;
$client = api_client_kuri($login['clienthash']);
$baseurl = SITE.'mybooks/'.$category.'/'.$filter.'/';
@@ -152,7 +152,7 @@ function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){
$items = clientbuys_kuri($client['clientmail'], $page, $category_id, $client['clientgroup_id'], $filter);
$count = $items['count'];
if ($count > $limit){
$pages = ceil($count / $limit);
}
@@ -161,19 +161,19 @@ function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){
$title = "Моя библиотека - страница $page";
$prevpage = $page - 1 ;
$prevurl = $baseurl.$prevpage;
}
}
else {
$title = "Моя библиотека";
}
$title = "Моя библиотека";
}
if ($pages > $page){
$nextpage = $page + 1;
$nexturl = $baseurl.$nextpage;
$endurl = $baseurl.$pages;
}
}
$tempcontent = VIEWPATH.'allbooks.phtml';
include VIEWPATH.'layout.phtml';
@@ -183,16 +183,18 @@ function mybooks_kuri($category = 'gazeta', $filter = 'all', $page = 1){
function form_kuri(){
$type='form';
$checklogin = check_login_kuri();
$title = "Бесплатные юридические консультации";
if ($checklogin['error'] == 'client not found'){
login_kuri();
}
else {
$tempcontent = VIEWPATH.'form.phtml';
include VIEWPATH.'layout.phtml';
}
}
}
@@ -210,18 +212,18 @@ function payments_kuri($filter = 1 ){
}
$paysql = "
SELECT
SELECT
buy_id, date, anbuy.price AS price, buy_status, pricename, category_id, pricehash
FROM
anbuy
FROM
anbuy
LEFT JOIN price ON
anbuy.number_id = price.price_id
WHERE
anbuy.number_id = price.price_id
WHERE
client_id = {$login['client_id']}
AND
buy_status = $filter
ORDER BY
buy_id DESC
ORDER BY
buy_id DESC
";
$payments = db_get($paysql);