diff --git a/ggg.php b/ggg.php new file mode 100644 index 0000000..9030112 --- /dev/null +++ b/ggg.php @@ -0,0 +1,78 @@ + 'error', + 'message' => 'Access denied for this admin phone.', + ]); + exit; +} + +// 3) التحقق من بقية المدخلات (action + text) +$action = $data['action'] ?? ''; +$text = trim($data['text'] ?? ''); + +if ($text === '' || ($action !== 'encrypt' && $action !== 'decrypt')) { + http_response_code(400); + echo json_encode([ + 'status' => 'error', + 'message' => 'Invalid input: need action=encrypt|decrypt and non-empty text.', + ]); + exit; +} + +// 4) تنفيذ التشفير / الفك +try { + // require_once __DIR__ . '/encrypt_decrypt.php'; + + if ($action === 'encrypt') { + $result = $encryptionHelper->encryptData($text); + } else { // decrypt + $result = $encryptionHelper->decryptData($text); + } + + echo json_encode([ + 'status' => 'success', + 'action' => $action, + 'result' => (string) $result, + ]); +} catch (Exception $e) { + http_response_code(500); + echo json_encode([ + 'status' => 'error', + 'message' => 'Operation failed.', + ]); +} \ No newline at end of file diff --git a/scratch_db_check.php b/scratch_db_check.php new file mode 100644 index 0000000..f182a6f --- /dev/null +++ b/scratch_db_check.php @@ -0,0 +1,23 @@ +prepare("SELECT id, name, role FROM admin"); + $stmt->execute(); + $admins = $stmt->fetchAll(PDO::FETCH_ASSOC); + print_r($admins); +} catch (Exception $e) { + echo "Error: " . $e->getMessage() . "\n"; +} + +echo "\n--- DATABASES ---\n"; +try { + $stmt = $con->prepare("SHOW DATABASES"); + $stmt->execute(); + $dbs = $stmt->fetchAll(PDO::FETCH_COLUMN); + print_r($dbs); +} catch (Exception $e) { + echo "Error: " . $e->getMessage() . "\n"; +} +?>