View file sp/index.php

File size: 4.08Kb
<?php
error_reporting(0);
header("Cache-Control: no-cache");
header("Content-type:text/html; charset=utf-8");
echo'<link rel="icon" href="/favicon.ico" type="image/x-icon">
<title>Di-X Master</title>
<link rel="stylesheet" href="/sp/style.css" type="text/css">
<div class="c"> <center><img src="/sp/logo.gif" alt=""/></center> </div>
<div class="block">Загрузки Di-X</div>
<div class="c"><div class="rekl">
<div class="sa">';

$login = '12345qw0';
$passw = '11111';

function query($url)
{
	global $session;
	$curl = curl_init(); 
	curl_setopt($curl,CURLOPT_URL,$url);
	curl_setopt($curl,CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']); 
	curl_setopt($curl,CURLOPT_COOKIE,'sid='.$session);
	curl_setopt($curl,CURLOPT_TIMEOUT,60); 
	curl_setopt($curl,CURLOPT_RETURNTRANSFER,1); 
	$result = curl_exec($curl); 
	curl_close($curl); 
	return $result;
}

if(filemtime('session.dat')+300<time())
{
	$result = query('http://spaces.ru/mysite/?name='.$login.'&password='.$passw);	
	preg_match('/sid=([0-9]{16})/',$result,$session);
	$session = $session[1];	
	$file=fopen('session.dat','w');
	fwrite($file,$session);
	fclose($file);
}else{
	$session = file_get_contents('session.dat');
}

empty($_SERVER['QUERY_STRING']) ? $q_str='shared_zone/' : $q_str=str_replace(':vopros:','/?',$_SERVER['QUERY_STRING']);

$result = query('http://spaces.ru/'.$q_str);
$result = preg_replace('/(\n|\r)+/','',$result);
$result = preg_replace('/<span style="font-size:small">(.*?)<\/span>/','$1',$result);
$result = preg_replace('/http:\/\/spaces\.ru\/([a-zA-Z_0-9]+)\/\?/','?$1:vopros:',$result);

if(empty($_SERVER['QUERY_STRING']))
{
	$result = preg_replace('/<div class="row3">(.*?)<\/div>/','$1<br />',$result);
	$result = preg_replace('/.+<div class="main">(.*?)<\/div>.+/','$1',$result);
	$result = preg_replace('/<a href="\?shared_zone:vopros:sid=[0-9]*&amp;moders=1">.+/','',$result);
}else{
	if(preg_match('/select_size/',$_SERVER['QUERY_STRING']))
	{
		$result = preg_replace('/.+Выберите размер/','Выберите размер',$result);
		$result = preg_replace('/<a href="[^"]+">Назад<\/a>.+/','<a href="?'.$_SESSION['back_url'].'">Вернуться</a>',$result);
	}else
	if(strpos($_SERVER['QUERY_STRING'],'shared_zone')==0)
	{
		if(preg_match('/dir=0/',$_SERVER['QUERY_STRING']))
		{
			$result = preg_replace('/.+<div class="main">/','<div class="main">',$result);
			$result = preg_replace('/<a href="\?shared_zone:vopros:sid=[0-9]*&amp;moders=1">.+/','',$result);
			$result = preg_replace('/<form.*?<\/form>/','',$result);
			$result = $result.'</div> </div><div class="c"><img src="/img/46.png" alt=""> <a href="?">Загрузки</a></div></div></div>';
		}else{
			preg_match('/<img src="http:\/\/spaces\.ru\/images\/Back\.gif" alt=""\/><a href=(.*?)<\/a>/',$result,$back);
			$result = preg_replace('/.+<div class="title">(.*?)<div class="title">.+/','<div class="dark">$1',$result);
			strpos($back[1],'Зона обмена') ? $back = '"?">Загрузки' : $back = $back[1];
			$result = $result.'<img src="../img/46.png" alt=""> <a href='.$back.'</a>';
			$result = preg_replace('/<form.*?<\/form>/','',$result);
			$result = preg_replace('/<small><p class="notes"> \* Если вы хотите(.*?)<p class="hr"><\/p>/','',$result);
		}
	}else{
		if(preg_match('/Нажимая ДА/',$result))
		{
			preg_match('/<a href="([^"]+)">Да<\/a>/',$result,$location);
			header('Location: '.$location[1]);
			exit;
		}else{
			$result = preg_replace('/.+<b>Зона обмена:<\/b>(.*?)<\/div>/','$1<br />',$result);
			$result = str_replace('<br/>(/)','',$result);
			preg_match('/<b>(Просмотров|Закачек):<\/b> ([0-9])+/',$result,$download);
			$result = preg_replace('/<div class="busi">.+/','',$result);
			$result = $result.$download[0];
			$_SESSION['back_url']=$_SERVER['QUERY_STRING'];
		}
	}
}
echo $result.'</div></div> </div><div class="c"> <a href="/">На главную</a></div></div>
<div class="block"> © RON 2oo9 - 2o1o</div><img src="/img/pwby.gif" alt="" /></a>';

require_once ("../incfiles/end.php");
?>