<?php
include_once '../sys/fnc.php';
/* ---- */	
/*
if (!isset($user)) {
header('location: /');
exit;
}
*/
/* ---- */	
$title = 'Услуги';
include_once '../sys/head.php';
echo '		<div id="page-wrapper">
			<div class="main-page">
				<h3 class="title1">VDS сервера</h3>
				<div class="blank-page widget-shadow scroll" id="style-2 div1">';
/*
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_vds` 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_vds` 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_vds` WHERE `status_activity` = '0' AND `id_dir` = '".$dir['id']."' ORDER BY `up` DESC LIMIT $start, ". $p_page);
while ($post = mysql_fetch_assoc($query)) {

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'] .'</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>SubWWW:  '. $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);
}
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_vds` 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_vds` 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_vds` 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 '					</p>
				</div>
			</div>
		</div>';
include_once '../sys/foot.php';
?>