<?php
/*
mod by denich
*/
$host = "wapos.ru";
$path = '/lib/index.php?'.$_SERVER['QUERY_STRING'];
$fp = fsockopen($host,80,$errno,$errstr,30);
if(!$fp) echo"$errstr ($errno)<br />\n";
else{
$headers = "GET $path HTTP/1.0\r\n";
$headers .= "Host: $host\r\n";
$headers .= "Accept: *\r\n";
$headers .="Accept-Charset: UTF-8\r\n"; // <<====
$headers .= "Accept-Charset: *\r\n";
$headers .= "Accept-Encoding: deflate\r\n";
$headers .= "Accept-Language: ru\r\n";
$headers .= "Referer: wapos.ru\r\n";
$headers .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; ru) Opera 8.01\r\n\r\n";
fwrite($fp,$headers);
while($file != "\r\n") $file = fgets($fp,128);
$file = "";
while(!feof($fp)) $file .= fgets($fp,4096);
fclose($fp);
}
$file = ereg_replace('<title>WAP.SASISA.RU</title>', '<title>ТВ Программа</title>',$file);
$file = ereg_replace('- <a href="http://wapos.ru">Ha глaвную</a><br/>', '',$file);
$file = ereg_replace('- <a href="http://wap2.1124.ru/demo/6577264562/,55">Дeмo-вepcии игp</a><br/>', '',$file);
$file = str_replace('<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"><wml>', '',$file);
$file = str_replace('<card id="WAPContact" title="wapos.ru library">', '',$file);
$file = str_replace('<p>', '',$file);
$file = str_replace('</p>', '',$file);
$file = str_replace('</card>', '',$file);
$file = str_replace('</wml>', '',$file);
$file = str_replace('<small>', '',$file);
$file = str_replace('</small>', '',$file);
$file = str_replace('<a href="c.php', '» <a href="c.php',$file);
$file = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '',$file);
$file = str_replace('<a href="c.php?', '<a href="c.php?site='.$site.'&tcolor='.$tcolor.'&fcolor='.$fcolor.'&lcolor='.$lcolor.'&',$file);
include '../head.php';
echo $file;
include '../foot.php';
?>