Размер файла: 3.41Kb
<?
define('SECURED', true);
include 'ini.php';
include 'inc/func_pages.php';
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
include_once '../sys/inc/thead.php';
if(empty($_GET['ID']))
{
title('Бесплатные игры');
err();
aut();
echo'<div class="menu">• <a href="new.php?'.SID.'">Новинки</a><br/>';
echo'• <a href="top.php?'.SID.'">ТОП-100</a><br/>';
echo'• <a href="poisk.php?'.SID.'">Поиск</a></div>';
echo'<div class="menu">';
$ntime = time() - (3600*24*$config['day_new']);
$q=mysql_query("select * from `categorys` order by `position`;");
while($category=mysql_fetch_array($q))
{
$total_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `games` WHERE `cat_id`='$category[id]';"),0);
$new_files = mysql_result(mysql_query("SELECT COUNT(*) FROM `games` WHERE `added` > '$ntime' AND `cat_id`='$category[id]';"),0);
if($new_files>0) $total_files.="<span style=\"color: #ff0000;\">+$new_files</span>";
echo '• <a href="'.$_SERVER['PHP_SELF'].'?ID='.$category['id'].'">'.$category['name'].'</a> ['.$total_files.']<br/>'; }
echo'</div>';
}
else
{
$id=intval($_GET['ID']);
$category=mysql_fetch_array(mysql_query("select * from `categorys` where `id`='$id';"));
title($category['name']);
err();
aut();
echo'<div class="menu">Сортировка<br/><a href="'.$_SERVER['PHP_SELF'].'?ID='.$id.'&sort=1">Дата</a>|';
echo'<a href="'.$_SERVER['PHP_SELF'].'?ID='.$id.'&sort=2">Алфавит</a>|<a href="'.$_SERVER['PHP_SELF'].'?ID='.$id.'&sort=3">Загрузок</a>|<a href="'.$_SERVER['PHP_SELF'].'?ID='.$id.'&sort=4">Рейтинг</a></div><div class="menu">';
if(!in_array($_GET['sort'],array(1,2,3,4))) $_GET['sort']=1;
$base_url=$_SERVER['PHP_SELF']."?ID=$id&sort=$_GET[sort]";
$num_items=mysql_result(mysql_query("select count(id) from `games` where `cat_id`='".$category['id']."';"),0);
$pages = ceil($num_items/$config['files_on_page']);
if(!empty($_REQUEST['page']))
{
$page = intval($_REQUEST['page']);
if($page<=0) $page=1;
if($page>=$pages) $page=$pages;
} else
{
$page = 1;
}
$start = $page * $config['files_on_page'] - $config['files_on_page'];
$sort_mode=$config['sorting_modes'][$_GET['sort']][0];
$q=mysql_query("select * from `games` where `cat_id`='$id' order by ".$sort_mode." limit $start,".$config['files_on_page'].";");
while($game=mysql_fetch_array($q))
{
echo '• <a href="game.php?ID='.$game['id'].'">'.$game['name'].'</a>';
if($sort_mode=='downloads desc') echo ' ['.$game['downloads'].']';
else if($sort_mode=='pos_rating desc') echo ' [+<span class="on">'.$game['pos_rating'].'</span>/-<span class="off">'.$game['neg_rating'].'</span>]';
else echo ' ['.date('d.m.y', $game['added']).']';
echo'<br/>';
}
echo pages($base_url, $pages, $page);
echo'</div>';
echo'<div class="menu">« <a href="/games/">Назад</a><br/></div>';
}
if (($link=file("".$config['count']."")) == true) {
$LinkCount=count($link);
$NL=rand(0, $LinkCount-1);
echo $link[$NL];
}
include_once '../sys/inc/tfoot.php';
?>