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

Размер файла: 1.67Kb
<?
include "cfg.php";
header ("Content-type:text/vnd.wap.wml; charset=utf-8");
print '<?xml version="1.0" encoding="utf-8"?>';
print '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">'.
'<wml><head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>';
print '<card title="'.$lang['news'].'">'.
'<p align="left">';
if (!@$s) $s=0;
if ($act=='del') mysql_query("delete from `news` where id=$id");
$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/>';
$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/>';
	print '<a href="index.php?act=del&amp;pass='.$pass.'&amp;id='.$data['id'].'">Del</a><br/>';
	$r1=@mysql_fetch_array(mysql_query("select count(*) from `news_com` where nid='".$data['id']."';"));
	print '<a href="opinion.php?id='.$data['id'].'&amp;pass='.$pass.'">'.$lang['opinion'].'['.$r1['count(*)'].']</a><br/>';
}
$razd='';
if ($s!=0) { print '<a href="index.php?s='.($s-1).'&amp;pass='.$pass.'">'.$lang['back'].'</a>'; $razd=' | ';};
if (($s==0)&&($count>$lim*$s+1)) print '<a href="index.php?s=1&amp;pass='.$pass.'">'.$lang['archive'].'</a>'; else
if ($count>$s*$lim+$lim) print $razd.'<a href="index.php?s='.($s+1).'&amp;pass='.$pass.'">'.$lang['next'].'</a>';
print '</p></card></wml>';
?>