|
Server IP : 217.21.85.138 / Your IP : 216.73.216.103 Web Server : LiteSpeed System : Linux in-mum-web906.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64 User : u915722082 ( 915722082) PHP Version : 7.4.33 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF Directory (0755) : /home/u915722082/.nvm/../public_html/logs/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
// request_logger_central.php
// Central request logger — appends one line per request to central app-access.log
// Writes only POST keys (not values) to avoid storing sensitive data.
$centralLog = '/home/u915722082/domains/thedotstudios.com/public_html/logs/app-access.log';
// Ensure timezone
if (!ini_get('date.timezone')) {
date_default_timezone_set('Asia/Kolkata');
}
$time = date('Y-m-d H:i:s');
$ip = $_SERVER['REMOTE_ADDR'] ?? '-';
$method = $_SERVER['REQUEST_METHOD'] ?? '-';
$uri = $_SERVER['REQUEST_URI'] ?? '-';
$host = $_SERVER['HTTP_HOST'] ?? '-';
$referer = $_SERVER['HTTP_REFERER'] ?? '-';
$ua = $_SERVER['HTTP_USER_AGENT'] ?? '-';
// Log only POST keys (names) to avoid capturing sensitive values
$postKeys = '';
if ($method === 'POST' && !empty($_POST)) {
$keys = array_map(function($k){
// sanitize keys: keep alnum, underscore, hyphen
return preg_replace('/[^a-zA-Z0-9_\-]/', '', (string)$k);
}, array_keys($_POST));
$postKeys = ' POST_KEYS=' . implode(',', $keys);
}
// Compose a single-line log entry
$line = sprintf("[%s] %s %s %s Host:%s Referer:%s UA:%s%s\n",
$time, $ip, $method, $uri, $host, $referer, $ua, $postKeys
);
// Append with exclusive lock; suppress warnings if any
@file_put_contents($centralLog, $line, FILE_APPEND | LOCK_EX);