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

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

define('_IN_JOHNCMS', 1);

$headmod = 'lib';
$textl = 'Библиотека';
require_once ("../incfiles/core.php");
require_once ("./inc/conf.php");
require_once ("../incfiles/head.php");
if($rights == 5 || $rights >= 6)
{
echo '<a href="admin.php?">В админку</a><br/>';
$total = mysql_result(mysql_query("select COUNT(*) from `lib_zak` where `type` = '0'"),0);
$total_p = mysql_result(mysql_query("select COUNT(*) from `lib_zak` where `type` = '1'"),0);
echo '<a href="admin_zak.php?act=pre">Принятые</a>('.$total_p.')';
switch($act)
{
    default:
if($total > 0)
{
    $sql = mysql_query("select * from `lib_zak` where `type` = '0'");
    while($res = mysql_fetch_array($sql))
    {
        $i = 1;
        echo ($i % 2) ? '<div class="list1">' : '<div class="list2">';
        $us = mysql_fetch_array(mysql_query("select `name` from `users` where `id` = '".$res['user']."'"));
        echo 'Заказчик - <strong>'.$us['name'].'</strong> ('.date("d.m.Y / H:i",$res['time']).')<br/>';
        echo 'Заказ:<br/><div class="fmenu"><strong>'.$res['text'].'</strong></div>';
        echo '[<a href="admin_zak.php?act=del&amp;id='.$res['id'].'">Отклонить</a>] | [<a href="admin_zak.php?act=yes&amp;id='.$res['id'].'">Принять</a>]';
        echo '</div>';
    }
    if ($total > $kol_file) {
        echo '<p>' . pagenav('admin_zak.php?', $start, $total, $kol_file) . '</p>';
    }
}else{
    echo '<br/>Нет не расмотренных заказов<br/>';
}
break;
case "yes":
if(mysql_query("update `lib_zak` set `type` = '1' where `id` = '".$id."' LIMIT 1"))
{
    header("Location: admin_zak.php?");
}else{
    header("Location: admin_zak.php?no");
}
break;
case "del":
if(mysql_query("DELETE from `lib_zak` where `id` = '".$id."' LIMIT 1"))
{
    header("Location: admin_zak.php?");
}else{
    header("Location: admin_zak.php?no");
}
break;
case "pre":
if($total_p > 0)
{
    $sql = mysql_query("select * from `lib_zak` where `type` = '1'");
    while($res = mysql_fetch_array($sql))
    {
        $i = 1;
        echo ($i % 2) ? '<div class="list1">' : '<div class="list2">';
        $us = mysql_fetch_array(mysql_query("select `name` from `users` where `id` = '".$res['user']."'"));
        echo 'Заказчик - <strong>'.$us['name'].'</strong> ('.date("d.m.Y / H:i",$res['time']).')<br/>';
        echo 'Заказ:<br/><div class="fmenu"><strong>'.$res['text'].'</strong></div>';
        echo '[<a href="admin_zak.php?act=del&amp;id='.$res['id'].'">Удалить</a>]';
        echo '</div>';
    }
    if ($total_p > $kol_file) {
        echo '<p>' . pagenav('admin_zak.php?', $start, $total_p, $kol_file) . '</p>';
    }
}else{
    echo '<br/>Нет не расмотренных заказов<br/>';
}
break;
}
}
require_once ("../incfiles/end.php");
?>