jilo-web/public_html/static/loadcache.php

23 lines
576 B
PHP
Raw Normal View History

2024-10-02 13:35:10 +00:00
<?php
session_name('jilo');
session_start();
$agent = $_GET['agent'];
// Check if cached data exists in session
if (isset($_SESSION["agent{$agent}_cache"])) {
// return status, the data, and caching time - in JSON
echo json_encode([
'status' => 'success',
'data' => $_SESSION["agent{$agent}_cache"],
'cache_time' => $_SESSION["agent{$agent}_cache_time"] ?? time() // we store cache time in the session
]);
} else {
// If no cached data exists
echo json_encode(['status' => 'error', 'message' => 'No cached data found']);
}
?>