s
This commit is contained in:
@@ -80,7 +80,48 @@ function addcard($id, $date) {
|
||||
}
|
||||
|
||||
|
||||
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';
|
||||
include VIEWPATH.'layout.phtml';
|
||||
}
|
||||
else {
|
||||
$title = 'Восстановление пароля';
|
||||
$tempcontent = VIEWPATH.'restore.phtml';
|
||||
include VIEWPATH.'layout.phtml';
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function resetlink_kuri($hash){
|
||||
|
||||
$res = api_restore_hash($hash);
|
||||
|
||||
if (!$res){
|
||||
|
||||
}
|
||||
else {
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Location: ${SITE}/resetpwd/"); exit();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
34
app/routes/email.php
Normal file
34
app/routes/email.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
function sendmail($config, $mail){
|
||||
|
||||
$send = new PHPMailer;
|
||||
$send->isSMTP();
|
||||
//$send->SMTPDebug=3; // Set mailer to use SMTP
|
||||
$send->Host = $config['host']; // Specify main and backup SMTP servers
|
||||
$send->Username = $config['login']; // SMTP username
|
||||
$send->Password = $config['password'];
|
||||
|
||||
if (isset($frommail['secure'])) {
|
||||
$send->SMTPSecure = $frommail['secure'];
|
||||
$send->SMTPAuth = true;
|
||||
}
|
||||
else {
|
||||
$mail->SMTPSecure = false;
|
||||
$mail->SMTPAutoTLS = false;
|
||||
}
|
||||
|
||||
$send->Port = $config['port']; // TCP port to connect to
|
||||
$send->setFrom($config['mail'], $config['name']);
|
||||
$send->addAddress($mail, $mail); // Add a recipient
|
||||
$send->CharSet = 'UTF-8';
|
||||
$send->isHTML(True); // Set email format to HTML
|
||||
$send->Subject = $mail['subject'];
|
||||
$send->Body = $mail['message'];
|
||||
|
||||
return $send->send();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user