This commit is contained in:
Your Name
2020-07-02 17:27:30 +03:00
parent 25a8c8c078
commit 4dfd676d95
8 changed files with 179 additions and 2 deletions

View File

@@ -32,6 +32,83 @@ function api_login($login, $password){
}
function api_restore_mail($mail){
$date = date("Y-m-d H:i:s");
$hash = md5($mail.$date);
$add = [];
$add['mail'] = $mail;
$add['restore'] = false;
$add['date'] = $date;
$add['hash'] = $hash;
$res = db_insert('restorations', $add);
if ($res > 0)
return $hash;
}
function api_restore_hash($hash){
$re_sql = "
SELECT
`id`, `restore`, `mail`
FROM
`restorations`
WHERE
`hash` = '$hash'
LIMIT
'1'
";
$res = db_get($re_sql);
if (isset($res['restore']) AND $res['restore'] == 0){
db_get("
UPDATE
`restorations`
SET
`restore` = '1'
WHERE
`id` = '${res['id']}'
");
db_get("
UPDATE
`clients`
SET
`clientpassword` = ''
WHERE
`clientmail` = '${res['mail']}'
");
$client_hash = db_get("
SELECT
`clienthash`
FROM
`clients`
WHERE
`client_mail` = '${res['mail']}'
LIMIT
1");
if (isset($client_hash['clienthash']))
return $client_hash;
else
return false;
}
else
return false;
}
function clientbuys_kuri($client_mail, $page = 1, $category_id = 1, $group_id = null, $filter = null){
if ($group_id == 1 or $group_id == 2){