phpMailer is not getting the values from my database

1

I'm trying to recover email and password, where:

$o_email = $_GET['email'];
$celular = $_GET['celular'];

Receives via email the user's email or mobile phone. But I'm not getting this recovered data to play in phpMailer.

What can I be doing wrong?

<?php


header('Content-type: application/json; charset=iso-8859-1"');
header('Access-Control-Allow-Origin: *');


include 'database.php';
include '../phpMailer/PHPMailerAutoload.php';

$o_email = $_GET['email'];
$celular = $_GET['celular'];


                $consulta = $pdo->prepare("SELECT nome, email, senha, celular FROM usuario_app WHERE email = '$o_email' OR (celular = '$celular')");
                $consulta->execute();

                $linha = $consulta->rowCount();

                foreach($consulta as $mostra):
                    $nome = addslashes(strip_tags($mostra['nome']));
                    $email = addslashes(strip_tags($mostra['email']));   
                    $senha = addslashes(strip_tags($mostra['senha']));   
                endforeach;  

                if($linha):                   
                    $_SESSION['nome'] = $nome;
                    $_SESSION['email'] = $email;                     
                    $_SESSION['senha'] = $senha;  
                endif;  

echo $nome;
echo $email;
echo $senha;


 $html = 'Olá ' . $nome . ', você pediu para recuperar sua senha. <br></br>


A sua senha é: ' .  $senha . '
<br></br>
Atenciosamente,
<br></br>
<b>Equipe VovóCooks,</b>
www.vovocooks.com.br';



$mail = new PHPMailer;

//$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.zoho.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = '[email protected]';                 // SMTP username
$mail->Password = 'sucessomundial2017';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, 'ssl' also accepted
$mail->Port = 587;                                    // TCP port to connect to

$mail->setFrom('[email protected]', 'VovoCooks App');
//$mail->addAddress('[email protected]', 'VovóCooks App');     // Add a recipient
$mail->addAddress($email);               // Name is optional

$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'Seu login e senha do VovoCooks App.';
$mail->Body    = $html;




if(!$mail->send()) {
    echo 'A mensagem não pode ser enviada.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;   
} else {
    echo 'Mensagem enviada';
    echo json_encode(array('message'=> 'Sua senha foi enviada para seu e-mail: ' + $to));
}


?>
    
asked by anonymous 25.07.2017 / 19:46

1 answer

1

The error is in the url see that it is $_GET['email']; and not $_GET['o_email'];

must be ....?email=.... and not ....?o_email=....

http://meusite.com.br/admin/apis/esqueci/[email protected]

or

http://meusite.com.br/admin/apis/esqueci/esqueci_netinho.php?celular=99......
    
25.07.2017 / 20:52