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

Размер файла: 1.43Kb
<?php
include_once 'lang.php';
include_once 'cfg.php';
header('Cache-Control:no-cache');
header('Content-type:text/vnd.wap.wml; charset=utf-8');
print '<?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>
<card title="'.$lang['news'].'">
<p align="left"><small>';
$s=intval($_GET['s']);
if(!@$s) $s=0;
$q=mysql_query("select count(id) from `news` where 1;");
$r=mysql_fetch_array($q);
$count=$r['count(id)'];
if($s*$lim+$lim>$count) $limit=$count-$s*$lim; else $limit=$lim;
print $lang['show'].($s*$lim+1).'-'.($s*$lim+$limit).'<br/>';
$q=mysql_query("select * from `news` where 1 order by id desc limit ".($s*$lim).", $limit");
while($data = @mysql_fetch_array($q)){
$date=(int)(date('d',$data['date'])).' '.$lang[date('m',$data['date'])];
print '<b><u>'.$date.'</u></b><br/>'.$data['text'].'<br/>';
$r1=mysql_fetch_array(mysql_query("select count(*) from `news_com` where nid='".$data['id']."';"));
print '<a href="opinion.php?id='.$data['id'].'">'.$lang['opinion'].'['.$r1['count(*)'].']</a><br/>';
}
$razd='';
if($s!=0){print '<a href="index.php?s='.($s-1).'">'.$lang['back'].'</a>'; $razd=' | ';}
if(($s==0)&&($count>$lim*$s+1)) print '<a href="index.php?s=1">'.$lang['archive'].'</a>'; else
if($count>$s*$lim+$lim) print $razd.'<a href="index.php?s='.($s+1).'">'.$lang['next'].'</a>';
print '<br/>---<br/>
<a href="/">На главную</a><br/>
</small></p></card></wml>';
?>