-1
I am trying to make a confirmation of registration by email, but I am not succeeding. I can get the user, email and password. but when I echo the $id and $md5 variable to check the data nothing appears and INSERT is not done. Follow the code.
<?php
$host = "mysql:busca;host=localhost";
$usuario = "root";
$pass = "";
try{
$pdo = new PDO($host, $usuario, $pass);
}catch(PDOExecption $e){
echo "Falha: ". $e->getMessage();
}
$user = addcslashes($_POST['user'],"F");
$email = addcslashes($_POST['email'],"F");
$senha = md5(addcslashes($_POST['senha'],"F"));
$pdo->query("INSERT INTO tabela1 SET user='$user', email='$email', senha='$senha'");
$id = $pdo->lastInsertId();
$md5 = md5($id);
$assunto = "Confirme seu cadastro";
$link = "confirma.php?h=".$md5;
$mensagem = '<a href="'.$link.'">Clique aqui para confirmar: </a>';
$header = "From: teste";
echo $user.'<br>';
echo $email.'<br>';
echo $senha.'<br>';
echo $id.'<br>';
echo $md5.'<br>';
mail($email, $assunto, $mensagem, $header);
?>
Table:
CREATE TABLE `tabela1` (
`id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user` varchar(50),
`email` varchar(100),
`senha` varchar(50),
`status` tinyint(4)
);