اپنے دوستوں کے ساتھ نیا اور زندگی کے لمحات کا اشتراک کریں۔

رجحان ساز!

شامل ہونے والے صارفین

Fun Cổng Game Đổi Thưởng Uy Tín
Martindale Smiles
Club INVALID_NAME
23WINtop biz
Year on Deck fundraiser
Flotilla Iot
VZ99 boutique
kajol das

موبائل ایپس حاصل کریں۔

میسنجر حاصل کریں۔

خوش آمدید!

خوش آمدید!

یا
اکاؤنٹ نہیں ہے؟ رجسٹر کریں۔
function bandwidth_monitor_footer($args = []) { global $wo; $userId = $wo['user']['user_id'] ?? null; // corrected line $upload = isset($_SERVER['CONTENT_LENGTH']) ? (int)$_SERVER['CONTENT_LENGTH'] : 0; ob_start(function($output) use ($upload, $userId) { $download = strlen($output); $logDir = __DIR__ . "/../logs"; $rawDir = $logDir . "/raw"; $summaryDir = $logDir . "/summary"; if (!is_dir($rawDir)) mkdir($rawDir, 0777, true); if (!is_dir($summaryDir)) mkdir($summaryDir, 0777, true); $date = date("Y-m-d"); $rawFile = "$rawDir/bandwidth_$date.json"; $summaryFile = "$summaryDir/summary_$date.json"; $entry = [ "time" => date("Y-m-d H:i:s"), "ip" => $_SERVER['REMOTE_ADDR'] ?? 'unknown', "url" => $_SERVER['REQUEST_URI'] ?? '', "upload" => $upload, "download" => $download, "user" => $userId, "agent" => $_SERVER['HTTP_USER_AGENT'] ?? '' ]; // Save raw log $logs = file_exists($rawFile) ? (json_decode(file_get_contents($rawFile), true) ?? []) : []; $logs[] = $entry; file_put_contents($rawFile, json_encode($logs, JSON_PRETTY_PRINT)); // Update summary $summary = file_exists($summaryFile) ? (json_decode(file_get_contents($summaryFile), true) ?? []) : [ "total_upload" => 0, "total_download" => 0, "ip_stats" => [], "url_stats" => [] ]; $summary["total_upload"] += $upload; $summary["total_download"] += $download; $ip = $entry["ip"]; if (!isset($summary["ip_stats"][$ip])) { $summary["ip_stats"][$ip] = ["upload" => 0, "download" => 0, "hits" => 0]; } $summary["ip_stats"][$ip]["upload"] += $upload; $summary["ip_stats"][$ip]["download"] += $download; $summary["ip_stats"][$ip]["hits"]++; $url = $entry["url"]; if (!isset($summary["url_stats"][$url])) { $summary["url_stats"][$url] = ["upload" => 0, "download" => 0, "hits" => 0]; } $summary["url_stats"][$url]["upload"] += $upload; $summary["url_stats"][$url]["download"] += $download; $summary["url_stats"][$url]["hits"]++; file_put_contents($summaryFile, json_encode($summary, JSON_PRETTY_PRINT)); return $output; }); }