-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_tokenissuer.php
47 lines (34 loc) · 1.06 KB
/
test_tokenissuer.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
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Content-Type');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Credentials: true');
error_reporting(0);
$_POST = json_decode(file_get_contents('php://input'), true);
//Database Connection
define('INCLUDE_CHECK', true);
require 'connect.php';
//Encryption Credentials
define('SECURE_CHECK', true);
require 'secure.php';
$schoolID = 'HMYHSS';
$mobile = "8075326268";
$accessLevel = "ADMIN";
date_default_timezone_set('Asia/Calcutta');
$date = date("Y-m-j");
$loginjson = array(
"mobile" => $mobile,
"schoolId" => $schoolID,
"accessLevel" => $accessLevel,
"date" => $date
);
$textToEncrypt = json_encode($loginjson);
//To encrypt
$encryptedMessage = openssl_encrypt($textToEncrypt, $encryptionMethod, $secretHash);
$token = $encryptedMessage;
echo $token;
//To Decrypt
$decryptedMessage = openssl_decrypt($encryptedMessage, $encryptionMethod, $secretHash);
//Result
echo "Encrypted: $encryptedMessage <br>Decrypted: $decryptedMessage";
?>