-
Notifications
You must be signed in to change notification settings - Fork 21
/
verifyEmail.php
46 lines (34 loc) · 1.27 KB
/
verifyEmail.php
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
36
37
38
39
40
41
42
43
44
45
46
<?php
include "connection.php";
if(isset($_GET['vkey'])){
// Process Verification
$vkey = $_GET['vkey'];
$sql = "SELECT verified,vkey FROM user WHERE verified = 0 AND vkey = '$vkey' LIMIT 1";
$result = mysqli_query($conn, $sql);
if(mysqli_num_rows($result) === 1){
// Validate Email
$update = "UPDATE user SET verified = 1 WHERE vkey = '$vkey' LIMIT 1";
$resultSet = mysqli_query($conn, $update);
if($resultSet)
{
define('Access', TRUE);
include "accountVerifiedPage.php";
} else {
echo $conn->error;
}
} else {
$sql = "SELECT verified,vkey FROM user WHERE verified = 1 AND vkey = '$vkey' LIMIT 1";
$result = mysqli_query($conn, $sql);
if(mysqli_num_rows($result) === 1){
define('Access', TRUE);
include "accountVerifiedPage.php";
} else {
define('Access', TRUE);
setcookie("verifiedEmailCookie", "emailInvalid", time()+(3600*24*2));
include "accountInvalidPage.php";
}
}
} else {
die("Something went wrong!");
}
?>