<?php

	# mark core  v1.0
    # author Drk in
	# date 24.10.19 	

	# core

	require_once ( $_SERVER['DOCUMENT_ROOT']."/_core/system.php" );

	# meta

	$title = 'Статистика » Мобильные WAP сайты';
	$description = system::check($config['description']);
	$keywords = system::check($config['keywords']);
	$tl = 'Статистика';
	
	# adm

	system::adm();

	# head

	require_once ( head );

	# coutn

	$cn_user 	= DB :: $dbh -> querySingle("SELECT count(id) FROM user");   
	$cn_user_d	= DB :: $dbh -> querySingle("SELECT count(id) FROM user WHERE data_reg > ?;", array(time()-86400));
	$cn_user_b  = DB :: $dbh -> querySingle("SELECT count(id) FROM user WHERE ban = ?;", array(1));
	
	$cn_cat     = DB :: $dbh -> querySingle("SELECT count(id) FROM cat");   
	
	$cn_pf 		= DB :: $dbh -> querySingle("SELECT count(id) FROM platforms");	
	$cn_pf_d 	= DB :: $dbh -> querySingle("SELECT count(id) FROM platforms WHERE time > ?;", array(time()-86400));
	$cn_pf_m 	= DB :: $dbh -> querySingle("SELECT count(id) FROM platforms WHERE mode = ?;", array(1));
	$cn_pf_m_d  = DB :: $dbh -> querySingle("SELECT count(id) FROM platforms WHERE mode = ? AND  time > ?;", array(1,time()-86400));
	$cn_pf_b 	= DB :: $dbh -> querySingle("SELECT count(id) FROM platforms WHERE ban = ?;", array(1));
	$cn_pf_b_d 	= DB :: $dbh -> querySingle("SELECT count(id) FROM platforms WHERE ban = ? AND  time > ?;", array(1,time()-86400));
	$cn_pf_g 	= DB :: $dbh -> querySingle("SELECT count(id) FROM platforms WHERE gold > ? ", array(time()));	

	$cn_hs 	= DB :: $dbh -> querySingle("SELECT sum(hs) FROM platforms");	
	$cn_ht 	= DB :: $dbh -> querySingle("SELECT sum(ht) FROM platforms");	
	$cn_in 	= DB :: $dbh -> querySingle("SELECT sum(`in`) FROM platforms");	
	$cn_ou 	= DB :: $dbh -> querySingle("SELECT sum(`ou`) FROM platforms");	
	$cn_pc 	= DB :: $dbh -> querySingle("SELECT sum(pc) FROM platforms");	
	$cn_mb 	= DB :: $dbh -> querySingle("SELECT sum(mb) FROM platforms");
	
	$cn_hs_t 	= DB :: $dbh -> querySingle("SELECT sum(hs_to) FROM platforms");	
	$cn_ht_t 	= DB :: $dbh -> querySingle("SELECT sum(ht_to) FROM platforms");	
	$cn_in_t 	= DB :: $dbh -> querySingle("SELECT sum(in_to) FROM platforms");	
	$cn_ou_t 	= DB :: $dbh -> querySingle("SELECT sum(ou_to) FROM platforms");	
	$cn_pc_t 	= DB :: $dbh -> querySingle("SELECT sum(pc_to) FROM platforms");	
	$cn_mb_t 	= DB :: $dbh -> querySingle("SELECT sum(mb_to) FROM platforms");	

	$cn_hs_a 	= DB :: $dbh -> querySingle("SELECT sum(hs_all) FROM platforms");	
	$cn_ht_a 	= DB :: $dbh -> querySingle("SELECT sum(ht_all) FROM platforms");	
	$cn_in_a 	= DB :: $dbh -> querySingle("SELECT sum(in_all) FROM platforms");	
	$cn_ou_a 	= DB :: $dbh -> querySingle("SELECT sum(ou_all) FROM platforms");	
	$cn_pc_a 	= DB :: $dbh -> querySingle("SELECT sum(pc_all) FROM platforms");	
	$cn_mb_a 	= DB :: $dbh -> querySingle("SELECT sum(mb_all) FROM platforms");	

	$cn_tk 		= DB :: $dbh -> querySingle("SELECT count(id) FROM tk");
	$cn_tkcat 	= DB :: $dbh -> querySingle("SELECT count(id) FROM tkcat");	
	$cn_tkcom 	= DB :: $dbh -> querySingle("SELECT count(id) FROM tkcom");	

	$cn_tk_d 	= DB :: $dbh -> querySingle("SELECT count(id) FROM tk WHERE time > ?;", array(time()-86400));
	$cn_tkcom_d = DB :: $dbh -> querySingle("SELECT count(id) FROM tkcom WHERE time > ?;", array(time()-86400));
	


	echo '
	<div class ="touch"> 
	Зарегистрировано пользователей : <font color ="green">'.$cn_user.'</font> '.($cn_user_d != 0 ? '<font color ="red">+ '.$cn_user_d.'</font> сегодня':'').'
	<br> Заблокированых пользователей : <font color ="green">'.$cn_user_b.'</font>
	<hr>
	Зарегистрировано сайтов: <font color ="green">'.$cn_pf.'</font> '.($cn_pf_d != 0 ? '<font color ="red">+ '.$cn_pf_d.'</font> сегодня':'').' 
	<br> На модерации сайтов: <font color ="green">'.$cn_pf_m.'</font> '.($cn_pf_m_d != 0 ? '<font color ="red">+ '.$cn_pf_m_d.'</font> сегодня':'').' 	
	<br> Заблокированых сайтов: <font color ="green">'.$cn_pf_b.'</font> '.($cn_pf_b_d != 0 ? '<font color ="red">+ '.$cn_pf_b_d.'</font> сегодня':'').' 
	<br> GOLD сайтов: <font color ="green">'.$cn_pf_g.'</font> 
	<hr> Тикетов : <font color ="green">'.$cn_tk.'</font> '.($cn_tk_d != 0 ? '<font color ="red">+ '.$cn_tk_d.'</font> сегодня':'').' 
	<br> Комментарии тикетов  : <font color ="green">'.$cn_tkcom.'</font> '.($cn_tkcom_d != 0 ? '<font color ="red">+ '.$cn_tkcom_d.'</font> сегодня':'').' 
	<br> Категории тикетов  : <font color ="green">'.$cn_tkcat.'</font> 
	<hr> Категорий : <font color ="green">'.$cn_cat.'</font>
	</div>

	<div class="touch">
	<table border="1" width="100%" style="text-align:center;">
	<tbody><tr>
	<td>период</td><td>хостов</td><td>хитов</td><td>в топ/из топа</td>
	</tr>
	<tr>
	<td><b>Cегодня</b></td>
	<td><font color="green">'.$cn_hs.'</font></td>
	<td><font color="red">'.$cn_ht.'</font></td>
	<td>'.$cn_in.'/'.$cn_ou.'</td>
	</tr>
	</tbody></table>
	<div style="padding: 4px;">
	<img src="'.ico.'mob.png" title="Мобильные и планшеты"> '.$cn_mb.' <b>
	<font color="red">+</font></b>
	<img src="'.ico.'pc.png" title="ПК"> '.$cn_pc.' <b>
	<font color="red">=</font></b> <u>'.($cn_mb + $cn_pc).'</u> хостов.
	</div>
	</div>

	<div class="touch">
	<table border="1" width="100%" style="text-align:center;">
	<tbody><tr>
	<td>период</td><td>хостов</td><td>хитов</td><td>в топ/из топа</td>
	</tr>
	<tr>
	<td><b>За вчера</b></td>
	<td><font color="green">'.$cn_hs_t.'</font></td>
	<td><font color="red">'.$cn_ht_t.'</font></td>
	<td>'.$cn_in_t.'/'.$cn_ou_t.'</td>
	</tr>
	</tbody></table>
	<div style="padding: 4px;">
	<img src="'.ico.'mob.png" title="Мобильные и планшеты"> '.$cn_mb_t.' <b>
	<font color="red">+</font></b>
	<img src="'.ico.'pc.png" title="ПК"> '.$cn_pc_t.' <b>
	<font color="red">=</font></b> <u>'.($cn_mb_t + $cn_pc_t).'</u> хостов.
	</div>
	</div>

	<div class="touch">
	<table border="1" width="100%" style="text-align:center;">
	<tbody><tr>
	<td>период</td><td>хостов</td><td>хитов</td><td>в топ/из топа</td>
	</tr>
	<tr>
	<td><b>За месяц</b></td>
	<td><font color="green">'.$cn_hs_a.'</font></td>
	<td><font color="red">'.$cn_ht_a.'</font></td>
	<td>'.$cn_in_a.'/'.$cn_ou_a.'</td>
	</tr>
	</tbody></table>
	<div style="padding: 4px;">
	<img src="'.ico.'mob.png" title="Мобильные и планшеты"> '.$cn_mb_a.' <b>
	<font color="red">+</font></b>
	<img src="'.ico.'pc.png" title="ПК"> '.$cn_pc_a.' <b>
	<font color="red">=</font></b> <u>'.($cn_mb_a + $cn_pc_a).'</u> хостов.
	</div>
	</div>

	<a href="'.site.'admin" class="touch">« Назад</a>
	';

	# foot

	require_once ( foot ) ;
?>