<?
include '../config.php';
include '../func.php';

head();
aut();
####################Запись онлайна##################
mysql_query("UPDATE `profile` SET `online` = 'umor' WHERE `id` = '".$id_session."'");
####################################################
echo head . 'Приколы из аськи и чатов' . div;
echo katalog;

$host = 'kengu.ru';
$path = '/humchat.php?'.$_SERVER['QUERY_STRING'];

$fp = fsockopen($host, 80, $errno, $errstr, 10);
if(!$fp) {
echo 'Сервис временно не доступен<br/>';
}
else {

$data = '';
$post=0;

foreach($_POST as $key=>$value){$post=1;
	$data.="&$key=$value";
}
if($data){
	$data = substr($data,1);
}

if($post){
$headers = "POST $path HTTP/1.0\r\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-Language: ru\r\n";
$headers .= "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; ru) Opera 8.01\r\n";
if($post){
$headers .= "Content-type: application/x-www-form-urlencoded\r\n";
$headers .= "Content-Length: ".iconv_strlen($data, 'UTF-8')."\r\n";
$headers .= "\r\n";
$headers .= $data;
}
else{
	$headers.="\r\n";
}

fwrite($fp, $headers);
while($file != "\r\n"){
	$file = @fgets($fp, 128);
}
$file = '';
while(!feof($fp)){
	$file .= @fgets($fp, 4096);
}
@fclose($fp);
}

$file=preg_replace("/^.*?\<body\>/",'',$file);
$file=substr($file,strpos($file,'<body>')+6);
$file=preg_replace("/<(\/|)div.*?>/",'',$file);
$file=preg_replace("/<(\/|)span.*?>/",'',$file);
$file=preg_replace("/style=\".*?\"/",'',$file);
$file=preg_replace("/&gt;<\/a>/",'$0<br>',$file);
$file=preg_replace("/&#169; KENGU.RU 2006-2007/",'',$file);
$file=preg_replace("/ПРИКОЛЫ ИЗ ЧАТОВ И АСЬКИ/",'',$file);
$file=str_replace('<a href="http://kengu.ru" >На главную</a>','',$file);
$file=str_replace('humchat','cit',$file);
$file=substr($file,0,strrpos($file,'</a>')+4);
$file = str_replace('<img src="http://kengu.ru/sample.gif" alt=\'counter\'/>','',$file);

echo $file . div;




//////////////////////////////////////

pod_navig();
foot();
?>