<?
#########################################
# Скрипт онлайн игры "Стритрейсинг"_____#
# Автор: -=FеST=-(СиК)__________________#
# ICQ : 345-22-23_______________________#
# Все права принадлежат автору(-=FeST=-)#
#########################################
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/adm_check.php';
include_once '../sys/inc/user.php';
$set['title']='Стритрейсинг';
include_once '../sys/inc/thead.php';
title();
err();
aut();

if(!isset($user)){
echo 'Вы неавторизованы';
include_once '../sys/inc/tfoot.php';
exit;
}
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `racing` WHERE `id_u`='".$user['id']."'"),0)==0)
mysql_query("INSERT INTO `racing`(`id_u`) VALUES('".$user['id']."')");
  $array=mysql_fetch_array(mysql_query("SELECT * FROM `racing` WHERE `id_u`='".$user['id']."'"));
   $car=mysql_fetch_array(mysql_query("SELECT * FROM `racing_car` WHERE `id`='".$array['car']."'"));
echo "
<div class='aut'>
<img src='ico/exp.gif' alt=''/>".$array['exp']."
<img src='ico/level.gif' alt=''/>".$array['level']."
<img src='ico/money.gif' alt=''/>".$array['money']."
<img src='ico/resp.gif' alt=''/>".$array['resp']."</div>
<div class='post'>
Сортировка : <a href='rate.php?sort=1'>Уров</a>|
<a href='rate.php?sort=2'>Побед</a>|
<a href='rate.php?sort=3'>Пораж</a>|
<a href='rate.php?sort=4'>Опыт</a>|
<a href='rate.php?sort=5'>Деньги</a>|
<a href='rate.php?sort=6'>Репут</a>|
<a href='rate.php?sort=7'>Самообл</a>|
<a href='rate.php?sort=8'>Реакц</a></div>

<center><img src='".$car['screen']."' alt=''/> <br/>".$car['name']."</center>
";
if(!isset($_GET['sort']))
$sort=1;
else
$sort=abs(intval($_GET['sort']));

$kaktuz_kol=mysql_result(mysql_query("SELECT COUNT(*) FROM `racing`"),0);
$k_page=k_page($kaktuz_kol,10);
$page=page($k_page);
$start=10*$page-10;
if($sort==1 || $sort>8)
$all_kaktuz=mysql_query("SELECT * FROM `racing` ORDER BY `level` DESC LIMIT $start,10");
elseif($sort==2)
$all_kaktuz=mysql_query("SELECT * FROM `racing` ORDER BY `win` DESC LIMIT $start,10");
elseif($sort==3)
$all_kaktuz=mysql_query("SELECT * FROM `racing` ORDER BY `lose` DESC LIMIT $start,10");
elseif($sort==4)
$all_kaktuz=mysql_query("SELECT * FROM `racing` ORDER BY `exp` DESC LIMIT $start,10");
elseif($sort==5)
$all_kaktuz=mysql_query("SELECT * FROM `racing` ORDER BY `money` DESC LIMIT $start,10");
elseif($sort==6)
$all_kaktuz=mysql_query("SELECT * FROM `racing` ORDER BY `resp` DESC LIMIT $start,10");
elseif($sort==7)
$all_kaktuz=mysql_query("SELECT * FROM `racing` ORDER BY `samoobl` DESC LIMIT $start,10");
elseif($sort==8)
$all_kaktuz=mysql_query("SELECT * FROM `racing` ORDER BY `reak` DESC LIMIT $start,10");
while($arr=mysql_fetch_array($all_kaktuz)){
   $cars=mysql_fetch_array(mysql_query("SELECT `name` FROM `racing_car` WHERE `id`='".$arr['car']."'"));
echo "<div class='rowup'>Гонщик : 
<a href='/info.php?id=".$arr['id_u']."'>".mysql_result(mysql_query("SELECT `nick` FROM `user` WHERE `id`='".$arr['id_u']."'"),0)."</a><br/>

<img src='ico/race.gif' alt=''/> Тачка : ".$cars['name']."<br/>
<img src='ico/win.gif' alt=''/> Побед : ".$arr['win']."<br/>
<img src='ico/lose.gif' alt=''/> Поражений : ".$arr['lose']."<br/>
<img src='ico/exp.gif' alt=''/> Опыт : ".$arr['exp']."<br/>
<img src='ico/level.gif' alt=''/> Уровень : ".$arr['level']."<br/>
<img src='ico/money.gif' alt=''/> Деньги : ".$arr['money']."<br/>
<img src='ico/resp.gif' alt=''/> Репутация : ".$arr['resp']."<br/>
<img src='ico/samoobl.gif' alt=''/> Самообладание : ".$arr['samoobl']."<br/>
<img src='ico/reak.gif' alt=''/> Реакция : ".$arr['reak']."</div>
";
}
if($k_page>1)str('?sort='.$sort.'&amp;',$k_page,$page);



echo "<div class='aut'><a style='display:block;' href='index.php'><img src='ico/back.png' alt=''/> Назад</a></div>";






include_once '../sys/inc/tfoot.php';
?>