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

Размер файла: 1.89Kb
<?php
include_once '../lang.php';
include_once '../cfg.php';
include_once '../filtro.php';
$s=intval($_GET['s']);
$act=$_GET['act'];
$id=intval($_GET['id']);
$ps=filtro($_REQUEST['ps']);
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>';
if($ps != $pass){echo 'Доступ запрещен!<br/>';}else{
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 $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/>
<a href="index.php?act=del&amp;ps='.$ps.'&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;ps='.$ps.'">'.$lang['opinion'].'['.$r1['count(*)'].']</a><br/>';
}
$razd='';
if($s!=0){print '<a href="index.php?s='.($s-1).'&amp;ps='.$ps.'">'.$lang['back'].'</a>'; $razd=' | ';}
if(($s==0)&&($count>$lim*$s+1)) print '<a href="index.php?s=1&amp;ps='.$ps.'">'.$lang['archive'].'</a>'; else
if($count>$s*$lim+$lim) print $razd.'<a href="index.php?s='.($s+1).'&amp;ps='.$ps.'">'.$lang['next'].'</a>';
}
print '<br/>---<br/><a href="add.php?ps='.$ps.'">Добавить новость</a><br/><a href="/">На главную</a><br/>
(c) by Azzido 2007</small></p></card></wml>';
?>