forked from hammadshahir/PHP-MySQL-ecommerce-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
verify.php
51 lines (44 loc) · 1.62 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
<?php require_once('header.php'); ?>
<?php
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'); ?>