-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathverify.php
61 lines (57 loc) · 1.96 KB
/
verify.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
require("includes/connection.php");
if(isset($_GET['email']) && isset($_GET['verification_code']))
{
$email = mysqli_real_escape_string($conn, $_GET['email']);
$verification_code = mysqli_real_escape_string($conn, $_GET['verification_code']);
$query = "SELECT * FROM `registered_users` WHERE `email`='$email' AND `verification_code`='$verification_code'";
$result = mysqli_query($conn, $query);
if($result)
{
if(mysqli_num_rows($result) == 1)
{
$result_fetch = mysqli_fetch_assoc($result);
if($result_fetch['is_verified'] == 0) // update user as verified
{
$update = "UPDATE `registered_users` SET `is_verified`='1' WHERE `email`='$email'";
if(mysqli_query($conn, $update))
{
echo "
<script>
alert('Email verification successful, now you can login');
window.location.href='new-login.php';
</script>
";
}
else
{
echo "
<script>
alert('UNKNOWN ISSUE: cannot run request!');
window.location.href='new-login.php';
</script>
";
}
}
else
{
echo "
<script>
alert('Email is already verified');
window.location.href='new-login.php';
</script>
";
}
}
}
else
{
echo "
<script>
alert('UNKNOWN ISSUE: cannot run request!');
window.location.href='login.php';
</script>
";
}
}
?>