Exemple #1
0
function recuperarSenha()
{
    global $pdo;
    $email = $_POST['emaillost'];
    $sql = "SELECT * FROM tb_usuarios WHERE email = '{$email}'";
    $query = $pdo->query($sql);
    $contador = $query->rowCount($sql);
    $resultado = $query->fetch(PDO::FETCH_ASSOC);
    if ($contador == 1 && $resultado['status'] == 1) {
        $url_login = url_login();
        $nova_url_login = substr_replace($url_login, '', -1) . '.php';
        $link_pass = geraSenha();
        $lostsenha = md5($link_pass);
        $data_hoje = date('Y-m-d H:i:s');
        $lost = "INSERT INTO tb_lostpassword (email, lostpassid, status, data) VALUES ('{$email}', '{$lostsenha}', '0', '{$data_hoje}');";
        $insert = $pdo->query($lost);
        $nome = $resultado['nome'];
        $subject = 'Recuperar senha - Painel Dental Arte';
        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->SMTPAuth = true;
        $mail->Host = "mail.axitech.com.br";
        $mail->Port = 465;
        $mail->Username = "******";
        $mail->Password = "******";
        $mail->SMTPSecure = 'ssl';
        $mail->SetFrom('*****@*****.**', 'AXITECH Informática');
        $mail->AddReplyTo("*****@*****.**", "AXITECH Informática");
        $mail->Subject = $subject;
        $mail->Body = "\n\t\t\t<!DOCTYPE html>\n\t\t\t<html lang=\"en\">\n\t\t\t<head>\n\t\t\t\t<meta charset=\"UTF-8\">\n\t\t\t</head>\n\t\t\t<body>\n\t\t\t\t<p>Você solicitou recentemente a redefinição de sua senha.</p>\t\n\t\t\t\t<p>Accesse o link a seguir para redefinir a sua senha: <br>\n\t\t\t\t\t<a href=" . $nova_url_login . '?usuario=' . $email . '&senhaperdida=' . $lostsenha . ">\n\t\t\t\t\t\t<strong>Clique aqui para recuperar sua senha</strong>\n\t\t\t\t\t</a>\n\t\t\t\t</p>\n\t\t\t</body>\n\t\t\t</html>\n\t\t\t";
        $mail->IsHTML(true);
        $mail->AddAddress($email, $nome);
        if (!$mail->Send()) {
            echo "\n\t\t        \t<META HTTP-EQUIV=REFRESH CONTENT = '0;URL=/login.php'>\n\t\t        \t<script type=\"text/javascript\">\n\t\t        \talert(\"Erro! Algum problema ocorreu ao tentar enviar a senha para seu e-mail.\");\n\t\t        \t</script>\n\t\t      \t";
        } else {
            echo "\n\t\t        \t<META HTTP-EQUIV=REFRESH CONTENT = '0;URL=/login.php'>\n\t\t        \t<script type=\"text/javascript\">\n\t\t        \talert(\"A senha foi encaminhada com sucesso para seu e-mail.\");\n\t\t        \t</script>\n\t\t      \t";
        }
    } else {
        echo "\n\t        \t<META HTTP-EQUIV=REFRESH CONTENT = '0;URL=/login.php'>\n\t        \t<script type=\"text/javascript\">\n\t        \talert(\"Atenção! Usuário inválido.\");\n\t        \t</script>\n\t      \t";
    }
}
Exemple #2
0
        ?>
        <div class="expense-image">
        <?php 
        if ($file->isImage()) {
            ?>
        	<p>
	        	<?php 
            $this->o($file->filename . ': ' . $expense->description);
            ?>
 
	        </p>
        	<?php 
            if ($this->mode == 'pdf' && za()->getConfig('require_http_auth')) {
                ?>
			<img src="<?php 
                echo url_login(za()->getConfig('http_user'), za()->getConfig('http_pass'), build_url('file', 'view', array('id' => $file->id), true)) . $file->filename . '?user='******'&amp;ticket=' . current_user()->getTicket();
                ?>
" />        
			<?php 
            } else {
                ?>
			<img src="<?php 
                echo build_url('file', 'view', array('id' => $file->id), true) . $file->filename . '?user='******'&amp;ticket=' . current_user()->getTicket();
                ?>
" />        			
			<?php 
            }
            ?>
	        
        <?php 
        } else {