<?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;
}
*/
echo '<div class="content--boxed">
                    <div class="content__header">
                        <h2>Виртуальный хостинг<small>Строим свои сайты на PHP</small></h2>
                    </div>';
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);
echo '<div class="row pricing-table">';
while ($post = mysql_fetch_assoc($query)) {
echo '<div class="col-sm-4">
    <div class="pricing-table__item">
        <div class="pricing-table__header"><h2>'. sprintf("%.02f", $post['price']) .' Р<small>| месяц</small></h2></div>
        <div class="pricing-table__name">'. html($post['name']) .'</div>
        <div class="pricing-table__body">
            <div class="pricing-table__list">Доменов: '. $post['domain'] .'</div>
            <div class="pricing-table__list">Память: '. $post['disk'] .' MB</div>
            <div class="pricing-table__list">Поддоменов: '. $post['sub_domains'] .'</div>
            <div class="pricing-table__list">Проектов: '. $post['domain'] .'</div>
            <div class="pricing-table__list">Трафик: '. $post['traffic'] .'</div>
        </div>
        <div class="pricing-table__footer"><a href="/scripts/products.php?id_tarif='.$post['id'].'"><i class="zmdi zmdi-check"></i></a></div>
    </div>
</div>';
}
echo '</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>      </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">';

echo '<br><br><Hr><hr><a href="/scripts/products.php?id_tarif='.$post['id'].'"><div class="row-one">
<div class="col-md-4 widget">
<div class="stats-left ">
<h5>Тариф</h5><h4>'. html($post['name']) .'</h4></div>
<div class="stats-right">
<label>'. sprintf("%.02f", $post['price']) .' Р</label></div>
<div class="clearfix"> </div></div>
<div class="col-md-4 widget states-mdl">
<div class="stats-left">
<h5>TF: '. $post['traffic'] .'</h5><h4>HDD: '. $post['disk'] .' MB</h4></div>
<div class="stats-right"><label>'. sprintf("%.02f", $post['price']) .' Р</label></div>
<div class="clearfix"> </div></div>
<div class="col-md-4 widget states-last">
<div class="stats-left">
<h5>SWWW:  '. $post['sub_domains'] .'</h5><h4>WWW : '. $post['domain'] .'</h4></div>
<div class="stats-right"><label> '. sprintf("%.02f", $post['price']) .' Р</label></div>
<div class="clearfix"> </div></div><div class="clearfix"> </div></div></a><hr>
';
}
if ($k_page > 1) str('?dir='. $dir['id'] .'&', $k_page, $page);
}
echo '<hr>';
include_once '../sys/foot.php';
?>