.1 |
<?php
.2 | if(!isset($_COOKIE['1zlwch'])&&!isset($_COOKIE['1zlwch'])){exit('<h1 style="font-family:corbel;color:#930;margin-left:1em">G\'day</h1>');}
.3 | echo'<!DOCTYPE html><html><meta name="viewport" content="width=device-width, initial-scale=1" /><style>
.4 | pre{display:inline}*{border-radius:8px;font-family:monospace;background:#ffb}body{margin:4em}.b{margin-left:1em}input,p,button{padding:0.5em;background-color:#fff;border:1px solid #930;}input{margin-top:0.5em;margin-bottom:0.5em}button{margin-top:0.5em}input:hover,button:hover{background:#dfd}</style>
.5 | <body><h2 style="margin-top:-1em">Find and replace</h2>
.6 | <form action="replace.php" target="" method="post">
.7 | <input name="f" size="10" placeholder="index.php" value="'.($_REQUEST['f']??'').'"><br>
.8 | <input name="a" size="70" placeholder="Original text"><br>
.9 | <input name="b" size="70" placeholder="Replacement"><br>
10 | <input type="hidden" name="tmr" value="'.time().'">
11 | <button>Submit changes</button></form><br><br>';
12 | 
13 | $k=file_get_contents($_REQUEST['f']??'replace.php');
14 | 
15 | if(empty($_REQUEST['b'])){$_REQUEST['b']=$_REQUEST['a'];}
16 | if(isset($_REQUEST['b'])&&$_REQUEST['b']=="clr"){$_REQUEST['b']="";}
17 | 
18 | if(isset($_REQUEST['a'])&&strlen($_REQUEST['a'])>2){
19 | $find=str_replace("`q","
20 | 
21 | ",$_REQUEST['a']);
22 | $k = str_replace($find,str_replace("^^^^","
23 | ",$_REQUEST['b']),$k);
24 | file_put_contents($_REQUEST['f'],$k);
25 | opcache_invalidate($_REQUEST['f']);
26 | 
27 | $change = $_REQUEST['tmr'].'*'.time().'*'.$_REQUEST['a'].'*'.$_REQUEST['b'].',';
28 | file_put_contents($_REQUEST['f'].'.txt',$change, FILE_APPEND);}
29 | 
30 | show_source($_REQUEST['f']??'replace.php');
31 | 
32 | echo '<a href="0.php">Editor</a>';
33 | ?></body></html>