-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathverify.php
executable file
·68 lines (58 loc) · 2.3 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
62
63
64
65
66
67
68
<?php require_once('header.php'); ?>
<?php
$email = $_REQUEST['email'];
$ckey = $_REQUEST['key'];
if((isset($email))&&(isset($email))){
$statement = $pdo->prepare("SELECT * FROM tbl_customer WHERE cust_email=?");
$statement->execute(array($email));
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
if($ckey = $row['subs_hash']) {
$statement = $pdo->prepare("UPDATE tbl_subscriber SET subs_active=?, WHERE cust_email=?");
$statement->execute(array(1,$email));
$success_message = '<p style="color:green;">Your email is verified successfully</p>';
}
}
}
if ( (!isset($_REQUEST['email'])) || (isset($_REQUEST['token'])) )
{
$var = 1;
// check if the token is correct and match with database.
$statement = $pdo->prepare("SELECT * FROM tbl_customer WHERE cust_email=?");
$statement->execute(array($_REQUEST['email']));
$result = $statement->fetchAll(PDO::FETCH_ASSOC);
foreach ($result as $row) {
if($_REQUEST['token'] != $row['cust_token']) {
header('location: '.BASE_URL);
exit;
}
}
// everything is correct. now activate the user removing token value from database.
if($var != 0)
{
$statement = $pdo->prepare("UPDATE tbl_customer SET cust_token=?, cust_status=? WHERE cust_email=?");
$statement->execute(array('',1,$_GET['email']));
$success_message = '<p style="color:green;">Your email is verified successfully. You can now login to our website.</p><p><a href="'.BASE_URL.'login.php" style="color:#167ac6;font-weight:bold;">Click here to login</a></p>';
}
}
?>
<div class="page-banner" style="background-color:#444;">
<div class="inner">
<h1>Registration Successful</h1>
</div>
</div>
<div class="page">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="user-content">
<?php
echo $error_message;
echo $success_message;
?>
</div>
</div>
</div>
</div>
</div>
<?php require_once('footer.php'); ?>