-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverify-user.php
41 lines (40 loc) · 1.36 KB
/
verify-user.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
<?php
require('config.php');
if(isset($_GET['code'])){
$code=mysqli_real_escape_string($conn,$_GET['code']);
$verification_query="select * from verification_status where code='$code'";
$verification_result=mysqli_query($conn,$verification_query);
if(mysqli_num_rows($verification_result)==1){
$verification_data=mysqli_fetch_assoc($verification_result);
if($verification_data['verified']==1){
echo "<div class='Form'>
<h3>Your account is already verified</h3><br/>
<p>Click here to return to the <a href='login.php'>login page</a>.</p>
</div>";
}
else{
$email=$verification_data['email'];
$update_query="update verification_status set verified=1 where email='$email'";
$update_result=mysqli_query($conn,$update_query);
if($update_result){
echo "<div class='Form'>
<h3>Congratulations, your account is verified!</h3><br/>
<p>Click here to return to the <a href='login.php'>login page</a>.</p>
</div>";
}
}
}
else{
echo "<div class='Form'>
<h3>No user found!</h3><br/>
<p>Click here to <a href='register.php'>register again</a>.</p>
</div>";
}
}
else{
echo "<div class='Form'>
<h3>Invlaid verification link!</h3><br/>
<p>Click here to <a href='register.php'>register again</a>.</p>
</div>";
}
?>