<?php
include_once 'protected/sys.php';

$sql=$db->fetchAll("SELECT * FROM `users` WHERE `vip`='yes' ORDER BY `vip_time` DESC",NULL);
$i=0;
function vip($time){
	$h = $time/3600%60;
	$m = $time/60%60;
	$s = $time%60;
	if ($h > 0 && $m> 0 && $s > 0)
	{
		return $h.'ч '.$m.'м '.$s.'c ';
	}
	if ($m> 0 && $s>0)
	{
		return  $m.'м '.$s.'с ';
	}
	if ($s > 0)
	{
		return $s.'с';
	}
}
foreach ($sql as $us)
{
  $i++;
$t=$us['vip_time']-time();
echo $i.")".$us['login']." - ".vip($t)."</br>";
}

?>
