403Webshell
Server IP : 188.114.96.3  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux sv058.home.net.pl 6.8.2 husak_dirty_pages_fix #1 SMP PREEMPT_DYNAMIC Tue Apr 2 22:06:51 CEST 2024 x86_64
User :  ( 3194769)
PHP Version : 8.5.12
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /polana/admin/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /polana/admin/polana-v182-instalator.php
<?php
declare(strict_types=1);
require_once dirname(__DIR__) . '/includes/polana_backup_v182.php';
require_admin_role();
header('Cache-Control: private, no-store');
header('X-Robots-Tag: noindex, nofollow');
$center = __DIR__ . '/polana-zarzadzanie.php';
$marker = '<!-- POLANA_V182_BACKUP_LINK -->';
$error = ''; $message = '';
try {
    $backup = pbk_private() . '/center-before-v182.php';
    $checksum = pbk_private() . '/center-v182.sha256';
    if (($_SERVER['REQUEST_METHOD'] ?? 'GET') === 'POST') {
        verify_csrf();
        $action = (string)($_POST['action'] ?? '');
        if ($action === 'install') {
            if (!is_file($center)) throw new RuntimeException('Brak pliku Centrum zarządzania.');
            $source = file_get_contents($center);
            if (!is_string($source)) throw new RuntimeException('Błąd odczytu Centrum.');
            if (str_contains($source, $marker)) { $message = 'Odnośnik do backupu już jest zainstalowany.'; }
            else {
                $anchor = '<div class="pz167">';
                if (substr_count($source, $anchor) !== 1) throw new RuntimeException('Nie rozpoznano układu Centrum. Bez zmian.');
                if (is_file($backup)) throw new RuntimeException('Istnieje wcześniejszy backup instalatora. Nie nadpisuję go.');
                if (file_put_contents($backup, $source, LOCK_EX) !== strlen($source)) throw new RuntimeException('Błąd zapisu backupu Centrum.');
                @chmod($backup, 0600);
                $link = $marker . "\n" . '<div style="max-width:1450px;margin:14px auto;padding:14px 18px;background:#eef5ed;border:1px solid #c6dcc7;border-radius:12px"><strong>Kopie zapasowe:</strong> <a href="/admin/polana-backup-automat.php">Automatyczny SQL / e-mail / Google Drive →</a></div>' . "\n";
                $new = str_replace($anchor, $link . $anchor, $source);
                $tmp = $center . '.v182-' . bin2hex(random_bytes(4)) . '.tmp';
                if (file_put_contents($tmp, $new, LOCK_EX) !== strlen($new)) { @unlink($tmp); throw new RuntimeException('Błąd zapisu poprawki.'); }
                @chmod($tmp, fileperms($center) & 0777);
                if (!rename($tmp, $center)) { @unlink($tmp); throw new RuntimeException('Błąd podmiany Centrum.'); }
                file_put_contents($checksum, hash_file('sha256', $center)); @chmod($checksum, 0600);
                $message = 'Dodano link do backupu w Centrum zarządzania. Pozostałe funkcje bez zmian.';
            }
        } elseif ($action === 'rollback') {
            if (!is_file($backup) || !is_file($checksum)) throw new RuntimeException('Brak kopii do cofnięcia.');
            if (!hash_equals(trim((string)file_get_contents($checksum)), hash_file('sha256', $center))) throw new RuntimeException('Centrum zmieniło się po instalacji — rollback zablokowany.');
            $source = file_get_contents($backup);
            if (!is_string($source) || !str_contains($source, 'render_admin_header')) throw new RuntimeException('Nieprawidłowa kopia Centrum.');
            $tmp = $center . '.rollback-' . bin2hex(random_bytes(4)) . '.tmp';
            file_put_contents($tmp, $source, LOCK_EX); @chmod($tmp, fileperms($center) & 0777);
            if (!rename($tmp, $center)) throw new RuntimeException('Błąd przywracania Centrum.');
            @unlink($backup); @unlink($checksum);
            $message = 'Przywrócono Centrum sprzed V18.2.';
        } else throw new RuntimeException('Nieznana operacja.');
    }
} catch (Throwable $e) { $error = $e->getMessage(); }
render_admin_header('POLANA V18.2 — instalator');
?>
<div style="max-width:860px;margin:35px auto;padding:22px;border:1px solid #d8e4d9;border-radius:15px;background:white">
<h1>POLANA V18.2 — kopie zapasowe</h1>
<p>Ten instalator <b>nie zmienia bazy danych</b> i nie nadpisuje istniejących modułów. Dodaje tylko link do automatycznych kopii w Centrum zarządzania.</p>
<?php if ($error): ?><p style="color:#b42318"><?=htmlspecialchars($error, ENT_QUOTES)?></p><?php endif; ?>
<?php if ($message): ?><p style="color:#12653c"><?=htmlspecialchars($message, ENT_QUOTES)?></p><?php endif; ?>
<p>Stan: <b><?=is_file($center) && str_contains((string)file_get_contents($center), $marker)?'Zainstalowany':'Do zainstalowania'?></b></p>
<form method="post"><?=csrf_field()?><input type="hidden" name="action" value="install"><button type="submit">Dodaj do Centrum z backupem</button></form>
<form method="post" onsubmit="return confirm('Przywrócić poprzednie Centrum?')"><?=csrf_field()?><input type="hidden" name="action" value="rollback"><button type="submit">Rollback</button></form>
<p><a href="/admin/polana-backup-automat.php">Przejdź do automatycznych kopii →</a></p>
</div>
<?php render_admin_footer(); ?>

Youez - 2016 - github.com/yon3zu
LinuXploit