<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////
// BotBanish 9.0.02
// Randem Systems: https://randemsystems.support
// BotBanish Cache Templates
// Date: 07/15/2026
// Usage: 
//
// Function: Shows Cache Files
///////////////////////////////////////////////////////////////////////////////////////////////////////

	$file = basename($_GET['file']);
	$cache = dirname($_GET['file']) . '/';
	$ip = str_ireplace('.cache', '', $file); 
	
	$self = substr($_SERVER['PHP_SELF'], strripos($_SERVER['PHP_SELF'], '/') + 1);
	$settings = realpath(str_ireplace($self, '../Include/BotBanish_PreIncludes.php', $_SERVER['SCRIPT_FILENAME']));
	
	require_once $settings;

	$_REQUEST['ip'] = $ip;
	$BotBanishCache = new BotBanishCache;
	
	if (!empty($cache) && is_dir($cache))
		$BotBanishCache->setCacheDir($cache);
	
	$BotBanishSession = $BotBanishCache->getCacheObject($ip);
	BotBanishShowCacheInfo($BotBanishSession);

function BotBanishShowCacheInfo($session) {

	BotBanishBrowserNoCache();
	
	echo '
	<!DOCTYPE html>
	<html>
	<head>
	</head>
	<body>';

	echo '
		<form action="" method="post">
			<table>';
			
			foreach ($session->sessionInfo as $key => $value) {
			
				if (!is_array($value))
					
					$data = BotBanishIsTimestamp($value);
				else
					$data = var_export($value, true);
				
				echo '
					<tr>
						<td width="5%" align="right">' . $key. ':</td>
						<td width="30%" align="left">' . $data . '</td>
					</tr><tr></tr>';
			}
			
	echo '
			</table>
		</form>
	</body>
	</html>';
}

function BotBanishIsTimestamp($value) {
	
	if (strlen((string)$value) < 10)
		return $value;
	
    // Check if the value contains only digits (handles numeric strings and integers)
	
    if (!ctype_digit((string)$value)) {
        return $value;
    }

    // Ensure it converts to a structurally valid Unix timestamp date range
	
    return date('Y-m-d H:i:s', $value);
}
?>