File size: 1.76Kb
<?
include '../config.php';
$sg="$homepage"; //////////Ссылка на главную /////
header("Content-type:text/vnd.wap.wml;charset=utf-8");
print "<?xml version=\"1.0\"?>
<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">
<wml>
<card id=\"news\" title=\"Новости\">
<p align=\"left\">
<br/>";
$user_agent_string = getenv("HTTP_USER_AGENT");
$host = gethostbyaddr($REMOTE_ADDR);
$ip = $REMOTE_ADDR;
$date = date("d-m-Y",time());
$time = date('H:i:s',time());
$text = "$user_agent_string::$host::$date::$time::$ip";
$fp=fopen("counter.txt","a");
fputs($fp,"$text \r\n");
fclose($fp);
$file=file("news.txt");
$vn=count($file);
print "Всего новостей:<small> $vn</small>
<br/>
==========
<br/>
";
$const=5;
$xfile = @file("news.txt");
$endfile = count($xfile);
$obrat=5;
$obrat2=1;
$a=$a+$const;
if ($endfile<$a) {$g=$a-$endfile; $a=$a-$g;}
if ($a<5) {$a=5;}
for ($i=count($xfile)-$a;$i<count($xfile)-$a+5;$i++)
{ $obrat=$i+5;
$obrat=$obrat-$obrat2;
$obrat2=$obrat2+2;
$udata = explode("::",$xfile[$obrat]);
print "
<br/>$udata[0]<br/>$udata[1]<br/>----------";} ////////// Разделитель
if ($a>count($xfile)) {$a=$a-10;}
if ($endfile>$a)
echo("<br/><a href=\"index.php?a=$a\">Далее</a>");
if ($a>5)
{$a=$a-10; echo("<br/><a href=\"index.php?a=$a\">Назад</a>");}
print "
<br/>
<a href=\"$sg\"><a href=\"$sg\">На главную</a></a></p>
</card>
</wml>";
?>