-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathverify.php
64 lines (48 loc) · 3.17 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
<?php
include 'dbconfig/dbInit.php';
if(isset($_GET['email']) && !empty($_GET['email']) AND isset($_GET['hash']) && !empty($_GET['hash'])){
$email = test_input($_GET['email']);
$hash = test_input($_GET['hash']);
// $sql = "SELECT * FROM login WHERE Email =:email AND Hash = :hash AND IsActive = 0";
$sql = "SELECT * FROM login WHERE Email =:email AND Hash = :hash";
$values = array(':email' => $email , ':hash' => $hash);
$data = $nss->select_query($sql, $values);
if($data){
foreach ($data as $value) {
# code...
// if($value['IsActive'] != 0 && $value['Hash'] == NULL)
if($value['IsActive'] != 0){
echo "<div class='alert alert-danger alert-dismissible text-center'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<strong>Your account has already been activated. </strong>.
</div>";
}
elseif($value['IsActive'] == 0){
// $sql = "UPDATE login SET IsActive = 1, Hash = NULL WHERE Email = :email AND Hash = :hash";
$sql = "UPDATE login SET IsActive = 1 WHERE Email = :email AND Hash = :hash";
$data = $nss->update_query($sql, $values);
if($data){
echo "<div class='alert alert-success alert-dismissible text-center'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>×</button>
<strong>Well done!</strong> Your account is now active, you can now login
</div>";
}
}
}
}
else{
echo "<div class='alert alert-danger alert-dismissible text-center'>
<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>x</button>
Verification failed, Please send a mail to customer support at support@sme4.me
</div>";
}
}
?>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
function sendform()
{
document.getElementById('jsform').submit();
}
$(document).ready(sendform);
</script>