I made a simple system to recover password. The system is working normally, but when the user clicks on the confirmation email, his email appears in the URI, what do I do? Here is the code:
This is the html form:
<section class="recipiente margem-topo-100">
<form action="recuperar_por_email.php" method="post" class="coluna">
<input type="text" name="recuperar-senha" placeholder="Insira seu email">
<button class="icones icone-enviar"></button>
</form>
</section>
This is the code that sends the email and creates the variables I use:
<?php
require_once "PHPMailer/PHPMailerAutoLoad.php";
require_once "interno/conecta.php";
require_once "interno/funcoes.php";
$recupera = $_POST['recuperar-senha'];
$link = "http://localhost/toqve/recuperar.php?recupera=".$recupera;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->isHTML(true);
$mail->CharSet = 'utf-8';
$mail->Host = 'mx1.weblink.com.br';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = '*********';
$mail->setFrom("[email protected]", "daLvz");
$mail->FromName = 'daLvz';
$mail->Subject = "Recuperar senha";
$mensagem = "Clique <a href=".$link.">aqui</a> para recuperar sua senha.
$mail->Body = $mensagem;
$mail->AltBody = "Conteudo do email em texto";
$mail->addAddress($recupera);
if($mail->Send()) {
header("Location: confirmacao.php");
} else {
echo "Erro ao enviar email". $mail->ErrorInfo;
}
This is the page that appears when the user clicks on the received email:
<?php
require_once "cabecalho.php";
require_once "interno/conecta.php";
require_once "interno/funcoes.php";
$recupera = $_GET['recupera'];
?>
<section class="recipiente margem-topo-100">
<form class="coluna" action="sucesso.php" method="post" >
<input type="text" name="recupera" value="<?=$recupera?>">
<input type="password" name="senha" placeholder="insira uma nova senha">
<button class="icones icone-enviar"></button>
</form>
</section>
Can anyone help me? Thanks!