add reminder

This commit is contained in:
Andrey Kuvshinov
2020-08-27 23:40:34 +03:00
parent 68d1d63f0d
commit f12eb20040
6 changed files with 116 additions and 5 deletions

View File

@@ -110,6 +110,100 @@ function test_client_hash_kuri($hash){
}
function reminder_kuri(){
if (isset($_POST['resetmail'])){
$resetmail = trim(mb_strtolower($_POST['resetmail']));
$client = db_get("SELECT * FROM `clients` WHERE `clientmail` = '$resetmail' LIMIT 1");
if (count($client) > 0 ) {
$resetdate = date('Y-m-d G:i:s');
$items = array();
$items['resetmail'] = $resetmail;
$items['client_id'] = $client['client_id'];
$items['resetdate'] = $resetdate;
$items['resetstatus'] = 0;
$items['resethash'] = md5($resetmail.$resetdate);
$result = db_insert('resetpwd', $items, 'klan');
$link = SITE.'resetpassword/'.$items['resethash'];
$tempcontent = VIEWPATH.'reminder_end.phtml';
include VIEWPATH.'layout_lite.phtml'; //центральный шаблон
}
else {
$error = 'Адрес электронной почты не найден';
$tempcontent = VIEWPATH.'reminder.phtml';
include VIEWPATH.'layout_lite.phtml'; //центральный шаблон
}
}
else {
$tempcontent = VIEWPATH.'reminder.phtml';
include VIEWPATH.'layout_lite.phtml'; //центральный шаблон
}
}
function resetpassword_kuri($hash){
$url = "/resetpassword/$hash";
$minlen = 5;
$resetsql = "SELECT * FROM `resetpwd` WHERE `resethash` = '$hash' AND `resetstatus` = '0' LIMIT 1";
$resetclient = db_get($resetsql);
if (count($resetclient) > 0){
if (isset($_POST['reset-submit'])){
$result = client_add_password($resetclient['client_id'], $_POST['new-password'], $_POST['confirm-password'], $minlen);
if (isset($result['newpassword'])){
db_get("UPDATE `resetpwd` SET `resetstatus` = 1 WHERE `resetpwd_id` = ${$client['client_id']}");
add_user_cookie($client['client_id'], $result['newpassword']);
$linklab = SITE.'mybooks';
$viewform = False;
}
}
else {
$viewform = True;
}
$tempcontent = VIEWPATH.'reset.phtml';
include VIEWPATH.'layout_lite.phtml';
}
else {
echo 'неверная ссылка';
return false;
}
return True;
}
// if(password_verify($_POST["password"],$hashed_password))
function resetpwd_kuri($hash){