📁 Unity Library Shares
'DJ Adds, Promos',
'sam_install_files' => 'Sam Install Files',
'devs' => 'Files from Devs',
'unityshares' => 'DJ Shares'
];
$filesPerPage = 25;
foreach ($folders as $key => $label) {
$directory = "C:/inetpub/unity shares/downloads/$key";
$pageVar = "page_$key";
$page = isset($_GET[$pageVar]) ? max(1, intval($_GET[$pageVar])) : 1;
echo "
";
echo "
$label
";
if (is_dir($directory)) {
$files = array_filter(scandir($directory), function ($file) use ($directory) {
return $file !== '.' && $file !== '..' && !is_dir($directory . '/' . $file);
});
natcasesort($files);
$files = array_values($files);
$totalFiles = count($files);
$start = ($page - 1) * $filesPerPage;
$pagedFiles = array_slice($files, $start, $filesPerPage);
echo "
| File | Download | Preview |
";
foreach ($pagedFiles as $file) {
$file_url = "downloads/$key/" . rawurlencode($file);
$ext = strtolower(pathinfo($file, PATHINFO_EXTENSION));
$icon = match ($ext) {
'mp3', 'wav', 'ogg', 'm4a', 'flac' => '🎵',
'zip', 'rar' => '🗜️',
'pdf' => '📄',
'txt' => '📃',
'jpg', 'jpeg', 'png', 'gif' => '🖼️',
'mp4', 'webm' => '🎬',
default => '📁'
};
$audioTypes = ['mp3', 'wav', 'ogg', 'm4a', 'flac'];
$imageTypes = ['jpg', 'jpeg', 'png', 'gif'];
$videoTypes = ['mp4', 'webm', 'ogg'];
echo "";
echo "| $icon " . htmlspecialchars($file) . " | ";
echo "Download | ";
echo "";
if (in_array($ext, $audioTypes)) {
echo "";
} elseif (in_array($ext, $imageTypes)) {
echo " ";
} elseif (in_array($ext, $videoTypes)) {
echo "";
} else {
echo "-";
}
echo " | ";
echo "
";
}
echo "
";
// Pagination
$totalPages = ceil($totalFiles / $filesPerPage);
if ($totalPages > 1) {
echo "";
}
} else {
echo "
Directory not found.
";
}
echo "
";
}
?>