-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverificarEmail.php
More file actions
35 lines (31 loc) · 945 Bytes
/
verificarEmail.php
File metadata and controls
35 lines (31 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
require 'config.php';
session_start();
if(isset($_GET['token']) && !empty($_GET['token'])) {
$token = addslashes($_GET['token']);
$verificar_token = "
SELECT * FROM
confirmar_email
WHERE
token_key = '$token'
AND
token_manual_expired = 0
AND
token_dt_expire > NOW();
";
$verificar_token = $pdo->query($verificar_token);
if($verificar_token->rowCount() > 0) {
$pegarEmail = "SELECT user_email FROM confirmar_email WHERE token_key = '$token';";
$pegarEmail = $pdo->query($pegarEmail);
foreach($pegarEmail->fetchAll() as $dados):
$email = $dados['user_email'];
endforeach;
echo $email;
$verificarEmail = "UPDATE usuarios SET email_confirmacao = 1 WHERE email = '$email';";
$verificarEmail = $pdo->query($verificarEmail);
$_SESSION['emailVerificado'] = '';
header('Location: login.php?emailVerificado');
} else {
header('Location: index.php');
}
}