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-v13-flagi-instalator.php
<?php
declare(strict_types=1);
require_once dirname(__DIR__).'/includes/functions.php';
require_admin_role();
$target=dirname(__DIR__).'/includes/functions.php';
$backupDir=dirname(__DIR__).'/storage/v13-backup';
$manifest=$backupDir.'/flags-v13.json';$error='';$result='';
if(($_SERVER['REQUEST_METHOD']??'')==='POST'){
 verify_csrf();
 try{
  $action=(string)($_POST['action']??'');
  if($action==='install'){
   if(is_file($manifest))throw new RuntimeException('V13 jest już włączona.');
   if(!is_file($target)||!is_readable($target)||!is_writable($target))throw new RuntimeException('Brak zapisu includes/functions.php');
   $s=(string)file_get_contents($target);
   if(str_contains($s,'POLANA_V13_FLAGS'))throw new RuntimeException('Wstawka V13 już istnieje');
   $pattern='~(<script\s+src="/assets/js/polana-v11-links\.js\?v=\d+"\s+defer></script>)~';
   if(preg_match_all($pattern,$s)!==1)throw new RuntimeException('Nie znaleziono skryptu flag V11. Wymagana aktywna V11.');
   $inject='$1' . "\n<!-- POLANA_V13_FLAGS -->\n<script src=\"/assets/js/polana-v13-flags-clean.js?v=13\" defer></script>";
   $next=preg_replace($pattern,$inject,$s,1);
   if(!is_string($next))throw new RuntimeException('Błąd przygotowania wstawki.');
   $asset=dirname(__DIR__).'/assets/js/polana-v13-flags-clean.js';
   if(!is_file($asset))throw new RuntimeException('Najpierw wgraj assets/js/polana-v13-flags-clean.js');
   if(!is_dir($backupDir)&&!mkdir($backupDir,0700,true))throw new RuntimeException('Brak katalogu kopii');
   file_put_contents($backupDir.'/.htaccess',"Require all denied\n",LOCK_EX);
   $backup=$backupDir.'/functions-'.date('Ymd-His').'-'.bin2hex(random_bytes(3)).'.php.bak';
   if(file_put_contents($backup,$s,LOCK_EX)!==strlen($s))throw new RuntimeException('Nie udało się utworzyć kopii.');
   if(hash_file('sha256',$target)!==hash('sha256',$s))throw new RuntimeException('Plik zmieniony w trakcie instalacji.');
   $temp=$target.'.v13_'.bin2hex(random_bytes(4));
   if(file_put_contents($temp,$next,LOCK_EX)!==strlen($next))throw new RuntimeException('Brak zapisu tymczasowego');
   @chmod($temp,fileperms($target)&0777);
   if(!rename($temp,$target)){@unlink($temp);throw new RuntimeException('Nie udało się zapisać functions.php');}
   file_put_contents($manifest,json_encode(['backup'=>$backup,'sha256'=>hash('sha256',$next)],JSON_UNESCAPED_SLASHES),LOCK_EX);
   $result='Aktywowano V13: zostają same flagi, stary przełącznik PL/EN jest usuwany z nawigacji.';
  }elseif($action==='rollback'){
   if(!is_file($manifest))throw new RuntimeException('Brak danych rollbacku.');
   $meta=json_decode((string)file_get_contents($manifest),true,512,JSON_THROW_ON_ERROR);
   if(!is_file($meta['backup']??''))throw new RuntimeException('Nie znaleziono kopii.');
   if(hash_file('sha256',$target)!==($meta['sha256']??''))throw new RuntimeException('functions.php został później zmieniony. Nie nadpisuję zmian.');
   if(!copy($meta['backup'],$target))throw new RuntimeException('Nie można przywrócić kopii.');
   unlink($manifest);$result='Przywrócono poprzedni functions.php.';
  }else throw new RuntimeException('Nieznana operacja');
 }catch(Throwable $e){$error=$e->getMessage();error_log('V13 flags: '.$error);}
}
render_admin_header('POLANA V13 — Flagi');
?>
<div style="max-width:850px;margin:25px auto;padding:22px;background:#fff;border-radius:14px;border:1px solid #ddd;color:#222">
<h1>V13 — tylko 4 flagi</h1>
<p>Dodaje skrypt usuwający stary, zdublowany przełącznik PL/EN z nawigacji. Nie rusza SEO, systemu V11 ani istniejącego skryptu zmiany języka. Instalacja tworzy backup <code>functions.php</code>.</p>
<?php if($error):?><p style="color:#a22"><?=e($error)?></p><?php endif;?>
<?php if($result):?><p style="color:#175b22"><?=e($result)?></p><?php endif;?>
<form method="post"><?=csrf_field()?><button name="action" value="install">Włącz tylko flagi</button></form>
<form method="post" style="margin-top:15px"><?=csrf_field()?><button name="action" value="rollback">Rollback</button></form>
</div>
<?php render_admin_footer(); ?>

Youez - 2016 - github.com/yon3zu
LinuXploit