-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVerificationManager.php
More file actions
86 lines (76 loc) · 1.77 KB
/
Copy pathVerificationManager.php
File metadata and controls
86 lines (76 loc) · 1.77 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
include_once './config_verify.php';
include_once './DatabaseManager.php';
/**
* Manage DB verification processes
*/
class VerificationManager {
private $db;
private $dbTable;
function __construct($debug = FALSE) {
if($debug == TRUE){
$this->dbTable = VERIFY_DB_TABLE."_QA";
}else{
$this->dbTable = VERIFY_DB_TABLE;
}
$this->db = new DatabaseManager(VERIFY_DB_HOST, VERIFY_DB_DATABASE, VERIFY_DB_USER, VERIFY_DB_PASS);
}
/*
* Check if verification code exist
*
* Returns: Boolean
*/
public function checkVerification($vid, $vCode)
{
$result = $this->db->selectquery("*", $this->dbTable, KEY_VID."='".$vid."' AND ".KEY_V_CODE."='".$vCode."'");
if($result == null){
return FALSE;
}
return TRUE;
}
/*
* Add a verification code
*
* Returns: JSON Status
*/
public function addVerification($vid, $vCode)
{
$values = "'".$vid."','".$vCode."',NULL,NULL,NULL";
if($this->db->insertquery($this->dbTable, $values)){
$output = array(
"status" => "SUCCESS",
"status_code" => 200,
"message" => "Verification code successfully added");
return $output;
}else{
$output = array(
"status" => "FAIL",
"status_code" => 400,
"message" => "failed to add verification code");
return $output;
}
}
/*
* Remove verification code
*
* Returns: Status array
*/
public function removeVerification($vid)
{
$where = KEY_VID."='".$vid."'";
if($this->db->deletequery($this->dbTable, $where)){
$output = array(
"status" => "SUCCESS",
"status_code" => 200,
"message" => "Verification code has been purged");
return $output;
}else{
$output = array(
"status" => "FAIL",
"status_code" => 200,
"message" => "Failed to purge verification code");
return $output;
}
}
}
?>