<?php
// test_permission.php
header('Content-Type: text/plain');

echo "=== Permission Test ===\n\n";

$dirs = [
    'uploads',
    'uploads/images', 
    'admin',
    'penguji'
];

foreach ($dirs as $dir) {
    if (file_exists($dir)) {
        $writable = is_writable($dir) ? 'WRITABLE' : 'NOT WRITABLE';
        $readable = is_readable($dir) ? 'READABLE' : 'NOT READABLE';
        echo "✓ $dir: $readable, $writable\n";
    } else {
        echo "✗ $dir: NOT EXISTS\n";
    }
}

echo "\n=== Image Files Test ===\n";
$images = glob('uploads/images/*.{jpg,jpeg,png,gif}', GLOB_BRACE);
foreach ($images as $image) {
    $readable = is_readable($image) ? 'READABLE' : 'NOT READABLE';
    echo basename($image) . ": $readable\n";
}

// Test .htaccess
echo "\n=== .htaccess Test ===\n";
if (file_exists('.htaccess')) {
    echo "✓ .htaccess exists\n";
    echo "Content: " . file_get_contents('.htaccess') . "\n";
} else {
    echo "✗ .htaccess not found\n";
}
?>