/
verify-fingerprint.php
61 lines (48 loc) · 1.24 KB
/
verify-fingerprint.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
<?php
include "./includes/config.php";
function verifyFingerprint($fingerprint){
//match fingerprint with db
$verifyStatus = in_array($fingerprint, FINGERPRINT);
if($verifyStatus){
//verified
return true;
}
else{
//unverified
return false;
}
}
function displayResponse($status, $msg, $response_data=[]) {
//response headers
header("Content-Type: application/json");
$response = array(
"status" => $status,
"msg" => $msg,
"response_data" => $response_data
);
//display response
echo json_encode($response);
}
if(isset($_REQUEST['fingerprint'])){
//convert array to variables
extract($_REQUEST);
if(verifyFingerprint($fingerprint)){
//verified
displayResponse("success", "Verification Successful");
}
else{
//unverified
$response_data = array(
"redirect_url" => "permission-denied.php"
);
displayResponse("error", "Verification Failed", $response_data);
}
}
else{
//unverified
$response_data = array(
"redirect_url" => "permission-denied.php"
);
displayResponse("error", "Verification Failed", $response_data);
}
?>