<?php
include_once '../sys/fnc.php';
/* ---- */	
/*
if (!isset($user)) {
header('location: /');
exit;
}
*/
/* ---- */	
$title = 'Услуги';
include_once '../sys/head.php';
/*
switch($_GET['act']) {
case 'add_dir':

break;
}
*/
if (isset($_GET['dir']))$dir['id'] = intval($_GET['dir']);

if ($dir['id'] == 0){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `services_dir"), 0) == 0) {
echo '<div class="err">Услуг не было добавлено</div>';
}
$query = mysql_query("SELECT * FROM `services_dir` ORDER BY `id` ASC");
while ($folder = mysql_fetch_assoc($query)) {
echo '<div class="menu"><img src="/style/img/link_g.png"> <a href="?dir='. $folder['id'] .'">
'. html($folder['name']) .' ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `services_orders` WHERE `status_activity` = '0' AND `id_dir` like '%". $folder['id'] ."%'"), 0) .')
</a></div>';
}
}else{

$c_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `services_orders` WHERE `status_activity` = '0' AND `id_dir` = '".$dir['id']."'"),0);
$p_page = '10';
$k_page = k_page($c_p, 10);
$page = page($k_page);
$start = 10*$page-10;
if ($c_p == 0) {
echo '<div class="err">Нет услуг</div>';
}
$query = mysql_query("SELECT * FROM `services_orders` WHERE `status_activity` = '0' AND `id_dir` = '".$dir['id']."' ORDER BY `up` DESC LIMIT $start, ". $p_page);
while ($post = mysql_fetch_assoc($query)) {

echo '<div class="menu_link">'. html($post['name']) .'</div>
<div class="post0">
Трафик : '. $post['traffic'] .' <br>
Жесткий диск : '. $post['disk'] .' МБ<br>
СубДомены : '. $post['sub_domains'] .' <br>
Домены : '. $post['domain'] .'<br>
Цена : '. sprintf("%.02f", $post['price']) .' Руб<br>
<a href="/scripts/products.php?id_tarif='.$post['id'].'">Заказать</a>
</div>
';

}
if ($k_page > 1) str('?dir='. $dir['id'] .'&', $k_page, $page);
}
include_once '../sys/foot.php';
?><?php
include_once '../sys/fnc.php';
/* ---- */	
/*
if (!isset($user)) {
header('location: /');
exit;
}
*/
/* ---- */	
$title = 'Услуги';
include_once '../sys/head.php';
/*
switch($_GET['act']) {
case 'add_dir':

break;
}
*/
if (isset($_GET['dir']))$dir['id'] = intval($_GET['dir']);

if ($dir['id'] == 0){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `services_dir"), 0) == 0) {
echo '<div class="err">Услуг не было добавлено</div>';
}
$query = mysql_query("SELECT * FROM `services_dir` ORDER BY `id` ASC");
while ($folder = mysql_fetch_assoc($query)) {
echo '<div class="menu"><img src="/style/img/link_g.png"> <a href="?dir='. $folder['id'] .'">
'. html($folder['name']) .' ('. mysql_result(mysql_query("SELECT COUNT(*) FROM `services_orders` WHERE `status_activity` = '0' AND `id_dir` like '%". $folder['id'] ."%'"), 0) .')
</a></div>';
}
}else{

$c_p = mysql_result(mysql_query("SELECT COUNT(*) FROM `services_orders` WHERE `status_activity` = '0' AND `id_dir` = '".$dir['id']."'"),0);
$p_page = '10';
$k_page = k_page($c_p, 10);
$page = page($k_page);
$start = 10*$page-10;
if ($c_p == 0) {
echo '<div class="err">Нет услуг</div>';
}
$query = mysql_query("SELECT * FROM `services_orders` WHERE `status_activity` = '0' AND `id_dir` = '".$dir['id']."' ORDER BY `up` DESC LIMIT $start, ". $p_page);
while ($post = mysql_fetch_assoc($query)) {
$i ++ ;
echo $i % 2 ? '<div class="post">' : '<div class="razd_menu">';


}
if ($k_page > 1) str('?dir='. $dir['id'] .'&', $k_page, $page);
}
include_once '../sys/foot.php';
?>