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

Размер файла: 1.59Kb
<?
include "cfg.php";
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
print '<?xml version="1.0" encoding="utf-8"?>'."\n";
print '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">'."\n".
'<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>'."\n";
print '<card title="'.$lang['news'].'">'."\n".
'<p align="left">'."\n";
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 $s*$lim;
print $lang['show'].($s*$lim+1).'-'.($s*$lim+$limit).'<br/>'."\n";
$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/>'."\n";
	$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/>'."\n";
}
$razd='';
if ($s!=0) { print '<a href="index.php?s='.($s-1).'">'.$lang['back'].'</a>'."\n"; $razd=' | ';};
if (($s==0)&&($count>$lim*$s+1)) print '<a href="index.php?s=1">'.$lang['archive'].'</a>'."\n"; else
if ($count>$s*$lim+$lim) print $razd.'<a href="index.php?s='.($s+1).'">'.$lang['next'].'</a>'."\n";
print '<br/>---<br/>'."\n";
print '<a href="http://wap.waup.ru">&#169; wap.waup.ru</a><br/>'."\n";
print '</p></card></wml>';
?>