<?php
#by Maksamka#
include 'head.php';
function view($url){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Opera/9.80 (J2ME/MIDP; Opera Mini/4.2.14912/27.1176; U; ru) Presto/2.8.119 Version/11.10');
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: text/html, application/xml;q=0.9, application/xhtml xml, image/png, image/jpeg, image/gif,image/x-bitmap, */*;q=0.1', 'Accept-Charset: utf-8;q=0.6 windows-1251;q=0.1*;q=0.1', 'Accept-Encoding: utf-8', 'Accept-Language: ru, en;q=0.9'));
curl_setopt($curl, CURLOPT_AUTOREFERER, 0);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 0);
$result = curl_exec($curl);
curl_close($curl);
if (!$result){
echo '<div class="menu">
Ошибка, мы уже работаем над её устранением...
</div>';
}
return $result;
}
$i = $_GET['i'];
$file=view('http://lib.mobik.ru/xxxhistory_new/'.(!empty($i) ? $i : ''));
$file=str_replace('href="http://lib.mobik.ru/xxxhistory_new/','href="?i=',$file);
$file=str_replace('<div class="menu_red">','<div class="stats">',$file);
$file=str_replace('<div class="line_a">','<div class="br2">',$file);

$file=preg_replace('|<a href="/show/?(.*?)>|si','',$file);
$file=str_replace('<div class="menu_red_a">','<div class="br2">',$file);

$file=str_replace('<?xml version="1.0" encoding="windows-1251"?>','',$file);
$file=preg_replace('|<div class="footer">(.*?)</html>|si','',$file);
$file=str_replace("<div class='line_c'>","<div class='stats'>",$file);
$file=str_replace('href="?i=text/download','href="http://lib.mobik.ru/xxxhistory_new/text/download',$file);

$file=preg_replace('|<!DOCTYPE(.*?)</div>|si','',$file);

echo $file;
include 'foot.php';

?>
