Файл: zagruz/azon/siza.php
Строк: 27
<?
# загрузка файла
$gdir = $_GET['d'];
if(!$gdir) $gdir = 'obmen/';
if(preg_match('/get_/i', $gdir)){
$gdir = str_replace('d=/', '/', $_SERVER['QUERY_STRING']);
header("Location: http://clubwm.ru/$gdir"); exit;
}
# ИНКЛУДИМ ЗАГОЛОВОК
@include 'head.php';
# НАСТРОЙКА СТИЛЕЙ
$DIV_ZAG = "head"; #стиль заголовка
$DIV_BODY = "box"; #стиль тела стр
# граббинг
$file = get_pg("http://clubwm.ru/$gdir");
$file = preg_replace('#<?xml version(.*)</head><body>#isU', '', $file);
$file = preg_replace("#<a href='(.*)(index)?#isU", "<a href='?d=", $file);
$file = str_replace(' ', ' ', $file);
# вывод
echo $file . '</div>';
if($gdir <> '/obmen/') echo '<a href="./">К началу</a><br/>';
echo '</div>';
#
function get_pg($url){
if (function_exists('curl_init')){
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, 'SamsungD500');
curl_setopt ($ch, CURLOPT_COOKIEJAR, "cookie.dat");
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.dat");
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_TIMEOUT, 10);
$result = curl_exec ($ch);
curl_close ($ch);
return $result;
}else{
$stream = stream_context_create(array('http' => array('method' => "GET",
'header' => "User-Agent: SamsungD500rn" . "Accept-language: enrn")));
return @file_get_contents($url, false, $stream);
}
}
# ИНКЛУДИМ НОГИ
@include 'foot.php';
?>