Просмотр файла news/index.php

Размер файла: 1.2Kb
<?php
error_reporting(0);
header('Content-type: text/vnd.wap.wml; charset=utf-8');
header('Cache-Control: no-cache, must-relative');
include('./conf/index.php');

echo '<?xml version=\'1.0\' encoding=\'UTF-8\'?><!DOCTYPE wml PUBLIC \'-//WAPFORUM//DTD WML 1.3//EN\' \'http://www.wapforum.org/DTD/wml13.dtd\'><wml><head><meta http-equiv=\'Cache-Control\' content=\'no-cache\' forua=\'true\'/></head><card id=\'news\' title=\'Новости\'><p align=\'left\'>';

if(empty($_GET['s'])) $s = 0; else $s = intval($_GET['s']);

if ($s < 0) $s = 0;
$num = 6;
$num = intval($num);

$all = mysql_num_rows(mysql_query("SELECT id FROM news"));
$all = intval($all);

if($all == 0)
{
echo 'Новостей нет.<br/><br/>';
}
else
{
$q = mysql_query("SELECT date,news FROM news ORDER BY id DESC LIMIT $s,$num;");

while($arr = mysql_fetch_array($q))
{
$date = $arr['date'];
$news = $arr['news'];

echo '<b><u>'.$date.'</u></b><br/>'.$news.'<br/><br/>';
}
}

if($all > $s + $num) echo '<a href=\'index.php?s='.($s+$num).'&amp;'.$r.'\'>Далее&#187;</a><br/>';

if($s != 0) echo '<a href=\'index.php?s='.($s-$num).'&amp;'.$r.'\'>&#171;Назад</a><br/>';

echo '<a href=\'http://'.$site.'\'>Главная</a></p></card></wml>';
?>