Файл: includes/service/newsfree.php
Строк: 71
<?php
error_reporting(7);
$name=explode('.',$_SERVER['HTTP_X_FORWARDED_HOST']);
$user=strtolower($name[0]);
$domain=strtolower($name[1]);
$path='/home/kmx/www/sites/'.$domain.'/'.$user;
if (!is_dir($path)) {header('Location: http://kmx.ru/?not_found');exit;}
$nocache=rand(100,999);
include('/home/kmx/includes/function_string.inc');
$site=$user;
$wmlfile='newsfree.wml';
$data['num']=130;
include('/home/kmx/includes/rand_reklama.php');
$reklama=$reklama;
Header("Content-type:text/vnd.wap.wml; charset=Utf-8");
Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
Header("Cache-Control: no-cache, must-relative");
$wml='<?xml version="1.0" encoding="Utf-8"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml_1.2.xml"><wml>';
touch($path.'/news-free-message.dat');
$page=$HTTP_GET_VARS['p'];
if ($page<1) $page=1;
print $wml.cyr2utf('<card id="news" title="'.strtoupper($user).'-Новости"><do name="m" type="options" label="На главную"><go href="http://'.$user.'.'.$domain.'.ru"/></do><p align="center"><small>'.$reklama.'</small></p><p><small>');
$f=fopen($path.'/news-free-message.dat','r+');
fseek($f,0,SEEK_SET);
$cntpage=1;
$screen='';
while ($cntpage<=$page)
{
while (true)
{
if (feof($f)) {print $screen; $screen=''; break; }
$printmsg='';
$tmpa=explode("t",fgets($f,65536),2);
if ((trim($tmpa[0])=='')||(trim($tmpa[1])=='')) continue;
$printmsg='<u><b>'.date("j.m.Y",$tmpa[0]).'</b></u> <br/>';
$printmsg.=cyr2utf(str_replace("$","$$",htmlspecialchars(trim($tmpa[1])))).' <br/> <br/>';
if (strlen($screen.$printmsg)>2350)
{
if ($cntpage==$page) { print $screen; $screen=''; break; }
else { $screen=$printmsg; break; }
}
$screen.=$printmsg;
}
$cntpage++;
if ($screen=='') break;
}
print '</small>';
if ($page>1) print cyr2utf('<a href="?p='.($page-1).'"><<<</a> <br/>');
if (!feof($f)) print cyr2utf('<a href="?p='.($page+1).'">>>></a> <br/>');
print '<a href="http://'.$user.'.'.$domain.'.ru" accesskey="#">На главную</a>';
print cyr2utf('</p></card></wml>');
exit();
?>