<?php

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

	# core

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

	$id =  isset( $_GET['id'] ) ? system::abs($_GET['id']): 0;

	if (cache_cat::ch($id) === false)system::header('/cat','Ошибка, ID не найден');

	$cat = cache_cat::check($id);

	# meta

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

	require_once ( head );

	echo '
	<table class="block" width="100%" style="padding: 2px;">
	<tbody><tr>
	<td><a href="'.site.'cat"><font color="white"><center>Категории</center></font></a></td>
	<td><center><b>'.system::check($cat['name']).'</b></center></td> 
	<td><a href="'.site.'gold"><font color="white"><center>GOLD сайты</center></font></a></td>
	</tr></tbody></table>
	';

	$cn =  DB :: $dbh -> querySingle("SELECT count(id) FROM platforms WHERE mode = ? AND ban = ? AND hs > ? AND cat = ?", array(0,0,0,$cat['id']));

	if ($cn == 0)echo '<div class="err">Cписок пуст!</div>';

	$page = new page($cn);

	$limit = $cn > $page -> elements ? $page -> limit : null;

	if ($cn > 0)echo '<table style="background: #ECEBE7;" width="100%"><tbody>';

	$query = DB :: $dbh -> query("SELECT id FROM platforms WHERE mode = ? AND ban = ? AND hs > ? AND cat = ? ORDER BY hs DESC {$limit}", array(0,0,0,$cat['id']));		

	$i = $page -> start;

	while ($act = $query -> fetch()):

	$i++;	

	$act = cache_pf::check($act['id']);	

	echo '
	<tr><td class="hide"><div class="cn"><center>'.$i.'</center></div></td>
	<td class="hide"><img src="'.save_img::fav($act['url']).'"> 
	<a referrerpolicy="origin" target="_blank" href="'.site.'ou/'.$act['id'].'" rel="nofollow" title="Посетить сайт '.system::check($act['url']).'">
	<b>'.system::check($act['url']).'</b></a>
	<font color="#999999">('.$act['hs'].'/'.$act['ht'].')</font> '.($act['gold'] > time() ? system::gold():'').'
	<a href="'.site.'link/'.$act['id'].'">
	<font style="float: right">
	<img src="'.ico.'stats.png" alt="">
	</font></a>
	<br>'.system::num(system::check($act['message']),86).'<br>
	</td>
	</tr>
	';	

	endwhile;
	
	if ($cn > 0)echo '</tbody></table>';

	$page -> get('?');

	echo '<a href="'.site.'" class="touch">« На главную</a>';

	# foot 

	require_once ( foot );

?>