| Server IP : 203.96.225.211 / Your IP : 216.73.216.228 Web Server : nginx/1.24.0 System : Linux iot1 6.8.0-151-generic #151-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 11 01:28:36 UTC 2026 x86_64 User : papel ( 1002) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /dma/project/php/sslcommerz/ |
Upload File : |
<?php
// Include the encryption and decryption functions
// include 'encrypt_decrypt_functions.php'; // Replace with the actual filename
function AppInfoEncryptUpDate($data = "", $key = "") {
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length("aes-256-cbc"));
$encrypted = openssl_encrypt($data, "aes-256-cbc", $key, 0, $iv);
return base64_encode($iv . '|||' . $encrypted);
}
function AppInfoDecryptUpDate($data = "", $key = "") {
list($iv, $encrypted_data) = explode('|||', base64_decode($data), 2);
return openssl_decrypt($encrypted_data, "aes-256-cbc", $key, 0, $iv);
}
// Check for POST data
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Check for the "action" parameter in the POST request
$input = json_decode(file_get_contents('php://input'), true);
if (isset($input['action'])) {
$action = $input['action'];
if ($action === 'encrypt') {
// Encrypt data
if (isset($input['data']) && isset($input['key'])) {
$data = $input['data'];
$key = $input['key'];
$encryptedData = AppInfoEncryptUpDate(json_encode($data), $key);
echo json_encode(['result' => 'success', 'data' => $encryptedData]);
} else {
echo json_encode(['result' => 'error', 'message' => 'Data or key parameter missing']);
}
} elseif ($action === 'decrypt') {
// Decrypt data
if (isset($input['data']) && isset($input['key'])) {
// $encryptedData = $input['encrypted_data'];
$encryptedData = $input['data'];
$key = $input['key'];
$decryptedData = AppInfoDecryptUpDate($encryptedData, $key);
echo json_encode(['result' => 'success', 'data' => $decryptedData]);
} else {
echo json_encode(['result' => 'error', 'message' => 'Encrypted data or key parameter missing']);
}
} else {
echo json_encode(['result' => 'error', 'message' => 'Invalid action']);
}
} else {
echo json_encode(['result' => 'error', 'message' => 'Action parameter missing']);
}
} else {
echo json_encode(['result' => 'error', 'message' => 'Invalid request method']);
}