Просмотр файла index.php

Размер файла: 2.7Kb
<?php
require_once "../includes/start.php";
require_once "../includes/functions.php";
require_once "../includes/header.php";
include_once "../themes/".$config['themes']."/index.php";

# загрузка файла
$gdir = $_GET['d'];
if(!$gdir) $gdir = 'loads/';
if(preg_match('/get_/i', $gdir)){
    $gdir = str_replace('d=/', '/', $_SERVER['QUERY_STRING']);
    header("Location: http://azon.mobi/$gdir"); exit;
    }

# НАСТРОЙКА СТИЛЕЙ
$DIV_ZAG = "head"; #стиль заголовка
$DIV_BODY = "box"; #стиль тела стр

# граббинг
$file = get_pg("http://azon.mobi/$gdir");
$file = preg_replace('#<\?xml version(.*)</head><body>#isU', '', $file);
$file = preg_replace('#<div class="foot">(.*)</html>#isU', '', $file);
$file = preg_replace('#<div class="">(.*)</div>#isU', '', $file);
$file = str_replace('</center></div>', '</center></div><div class="' . $DIV_BODY . '"> ', $file);
$file = str_replace('"head"', '"' . $DIV_ZAG . '"', $file);
$file = preg_replace('#<a href(.*)(search)(.*)/a>#', '', $file);
$file = preg_replace('#\|<a href(.*)(unar)(.*)/a>#i', '', $file);
$file = preg_replace('#<img src=(.*)(dls)(.*)\)<br \/>#i', '', $file);
$file = preg_replace('#<img src=(.*)(djs)(.*)\)<br \/>#i', '', $file);
$file = preg_replace('#<img src=(.*)(eroboo)(.*)\)<br \/>#i', '', $file);
$file = preg_replace('#<a href="(.*)(index)?#isU', '<a href="?d=', $file);
$file = str_replace('&nbsp;', ' ', $file);
$file = str_replace('&raquo;', ' ', $file);
$file = str_replace("\r\n", '', $file);
$file = str_replace('<hr align="left" width="110" /> <hr align="left" width="110" />', '', $file);
$file = preg_replace('#<img src="/g.(.*) />#', '', $file);
$file = str_replace('<img src="', '<img src="http://azon.mobi/', $file);
# вывод
echo $file . '</div>';
if($gdir <> 'loads/') 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: SamsungD500\r\n" . "Accept-language: en\r\n")));
         return @file_get_contents($url, false, $stream);
         }
    }

include_once "../themes/".$config['themes']."/foot.php";
?>