Просмотр файла mod.php

Размер файла: 2.66Kb
<?php

define('_IN_JOHNCMS', 1);

$headmod = 'lib';
$textl = 'Библиотека';
require_once ("../incfiles/core.php");
require_once ("./inc/conf.php");
$textl = 'Модерация статей';
require_once ("../incfiles/head.php");
if($rights == 5 || $rights >= 6)
{
    if(isset($_GET['error_pot']))
    {
        echo '<div class="">ОШИБКА!!!</div>';
    }
    if(isset($_GET['error_del']))
    {
        echo '<div class="">ОШИБКА!!!</div>';
    }
$sql = mysql_query("select * from `library` where `moder` = '0' and `type` = 'file' order by `name` ASC, `file` ASC LIMIT ".$start.",".$kol_file."");
$total = mysql_result(mysql_query("select COUNT(*) from `library` where `moder` = '0' and `type` = 'file'"),0);
if($total > 0)
{
while($res = mysql_fetch_array($sql))
{
    echo '<div class="list1">';
    echo '&deg;<img src="./img/page_white_text.png" alt="" /><a href="read.php?id='.$res['id'].'">'.$res['name'].'</a><br/>';
    $user = mysql_fetch_array(mysql_query("select `name` from `users` where `id` = '".$res['id_avtor']."' LIMIT 1"));
    echo '<ul>';
    echo '<li><strong>Добавил:</strong>'.$user['name'].'<br/></li>';
    $ee = mysql_fetch_array(mysql_query("select `name` from `library` where `id` = '".$res['fid']."'"));
    echo '<li>Раздел: [<a href="index.php?id='.$res['fid'].'">'.$ee['name'].'</a>]<br/></li>';
    echo '</ul>';
    echo '[<a href="mod.php?act=pot&amp;id='.$res['id'].'">Потвердить</a>]|[<a href="mod.php?act=del&amp;id='.$res['id'].'">Удалить</a>]';
    echo '</div>';
}
// Постраничная навигация
    if ($total > $kmess) {
        echo '<p>' . pagenav('mod.php?', $start, $total, $kol_file) . '</p>';
    }
    if($act == 'pot')
    {
        if(!empty($id))
        {
            if(mysql_query("update `library` set `moder` = '1' where `id` = '".$id."' LIMIT 1"))
            {
                header("Location: mod.php?");
            }else{
                header("Location: mod.php?error_pot");
            }
        }else{
            header("Location: mod.php?error_pot");
        }
    }
    if($act == 'del')
    {
        if(!empty($id))
        {
            if(mysql_query("DELETE FROM `library` WHERE `id` = '".$id."' LIMIT 1"))
            {
                header("Location: mod.php?");
            }else{
                header("Location: mod.php?error_del");
            }
        }else{
            header("Location: mod.php?error_del");
        }
    }
}else{
    echo 'Нет статей для модерации!!!<br/>';
    echo '<a href="index.php?">Назад</a>';
}
}
require_once ('../incfiles/end.php');
?>