Файл: dev/achievements.php
Строк: 987
<?
ini_set('display_errors', 'off');
include_once '../sys/core/start.php';
include_once '../sys/core/compress.php';
include_once '../sys/core/sess.php';
include_once '../sys/core/home.php';
include_once '../sys/core/settings.php';
include_once '../sys/core/db_connect.php';
include_once '../sys/core/ipua.php';
include_once '../sys/core/fnc.php';
include_once '../sys/core/user.php';
include_once '../sys/inc/fnc_game.php';
include_once '../sys/inc/thead.php';
include_once '../sys/inc/uhead.php';
only_reg();
###### Configurations module Achievements #######
# configurations Race
$race = array(
            array(    'name'             => 'Наблюдатель',
                    'race'             => 50,
                    'money'            => 15000,
                    'baks'            => 15,
                    'exp'            => 25,
                    'description'    => 'Мало ездит. Наблюдает со стороны <br> Награда : <img src="/style/img/icons/money.png">15K  <img src="/style/img/icons/baks.png">15 опыт 25 ',
                    ),
            array(    'name'             => 'Без тормозов',
                    'race'             => 500,
                    'money'            => 25000,
                    'baks'            => 45,
                    'exp'            => 90,
                    'description'    => 'Тормоза не для тебя. Только вперед!<br> Награда : <img src="/style/img/icons/money.png">25K  <img src="/style/img/icons/baks.png">45 опыт 90 ',
                    ),
            array(    'name'             => 'Азартный игрок',
                    'race'             => 1500,
                    'money'            => 35000,
                    'baks'            => 125,
                    'exp'            => 200,
                    'description'    => 'Гонки в твоей крови и жизнь твоя – заезд <br> Награда : <img src="/style/img/icons/money.png">35K  <img src="/style/img/icons/baks.png">125 опыт 200 ',
                    ),
            array(    'name'             => 'Гроза соперников',
                    'race'             => 5000,
                    'money'            => 85000,
                    'baks'            => 250,
                    'exp'            => 350,
                    'description'    => 'Опытный и опасный противник. Не прощает ошибок <br> Награда : <img src="/style/img/icons/money.png">85K  <img src="/style/img/icons/baks.png">250 опыт 350 ',
                    ),
            array(    'name'             => 'К барьеру!',
                    'race'             => 20000,
                    'money'            => 230000,
                    'baks'            => 500,
                    'exp'            => 450,
                    'description'    => 'Смелый и отчаянный пилот. Тебе мало просто побед <br> Награда : <img src="/style/img/icons/money.png">230K  <img src="/style/img/icons/baks.png">500 опыт 450 ',
                    ),
            array(    'name'             => 'Неудержимый',
                    'race'             => 50000,
                    'money'            => 360000,
                    'baks'            => 800,
                    'exp'            => 950,
                    'description'    => 'Финишный флажок – только начало новой гонки <br> Награда : <img src="/style/img/icons/money.png">360K  <img src="/style/img/icons/baks.png">800 опыт 950 ',
                    ),
            array(    'name'             => 'Я гоню!',
                    'race'             => 100000,
                    'money'            => 670000,
                    'baks'            => 1100,
                    'exp'            => 1250,
                    'description'    => 'Всегда и везде. В погоне за долями секунд <br> Награда : <img src="/style/img/icons/money.png">670K  <img src="/style/img/icons/baks.png">1.1K опыт 1.2K ',
                    )
            );
$rating = array(
            array(    'name'             => 'Реальный прогресс',
                    'rating'         => 500,
                    'money'            => 5000,
                    'baks'            => 15,
                    'exp'            => 25,
                    'description'    => 'Ты стремительно прогрессируешь. Дай всем жару!<br> Награда : <img src="/style/img/icons/money.png">5K  <img src="/style/img/icons/baks.png">15 опыт 25 ',
                    ),
            array(    'name'             => 'Стабильный игрок',
                    'rating'         => 2500,
                    'money'            => 25000,
                    'baks'            => 45,
                    'exp'            => 55,
                    'description'    => 'Стабильность – признак мастерства. Развивай свой успех!<br> Награда : <img src="/style/img/icons/money.png">25K  <img src="/style/img/icons/baks.png">45 опыт 55пыта',
                    ),
            array(    'name'             => 'Темная лошадка',
                    'rating'         => 5000,
                    'money'            => 75000,
                    'baks'            => 90,
                    'exp'            => 125,
                    'description'    => 'В гонках не всегда побеждают фавориты. Удача на твоей стороне<br> Награда : <img src="/style/img/icons/money.png">75K  <img src="/style/img/icons/baks.png">90 опыт 125 ',
                    ),
            array(    'name'             => 'Клуб «10 000»',
                    'rating'         => 10000,
                    'money'            => 225000,
                    'baks'            => 160,
                    'exp'            => 355,
                    'description'    => 'Добро пожаловать в закрытый клуб! Здесь только игроки с рейтингом 10 000+<br> Награда : <img src="/style/img/icons/money.png">225K  <img src="/style/img/icons/baks.png">160 опыт 355 ',
                    ),
            array(    'name'             => 'Стратег',
                    'rating'         => 25000,
                    'money'            => 355000,
                    'baks'            => 410,
                    'exp'            => 455,
                    'description'    => 'Больше чем просто гонщик. Предугадывает ходы соперника<br> Награда : <img src="/style/img/icons/money.png">355K  <img src="/style/img/icons/baks.png">410 опыт 455 ',
                    ),
            array(    'name'             => 'Срочно в Forbes!',
                    'rating'         => 50000,
                    'money'            => 525000,
                    'baks'            => 710,
                    'exp'            => 745,
                    'description'    => 'Тобой интересуются уже не только соперники, но и журналисты!<br> Награда : <img src="/style/img/icons/money.png">525K  <img src="/style/img/icons/baks.png">710 опыт 745 ',
                    ),
            array(    'name'             => 'Элита',
                    'rating'         => 100000,
                    'money'            => 750000,
                    'baks'            => 1100,
                    'exp'            => 1200,
                    'description'    => 'Успешный пилот и лидер. Настоящая элита Больших Гонок<br> Награда : <img src="/style/img/icons/money.png">750K  <img src="/style/img/icons/baks.png">1.1К опыт 1.2К ',
                    ),    
            array(    'name'             => 'Мэтр',
                    'rating'         => 250000,
                    'money'            => 1300000,
                    'baks'            => 1750,
                    'exp'            => 1945,
                    'description'    => 'Уважаемый человек и непререкаемый авторитет в мире гонок!<br> Награда : <img src="/style/img/icons/money.png">1М 300К  <img src="/style/img/icons/baks.png">1.7К опыт 2К ',
                    ),
            array(    'name'             => 'Графский орден',
                    'rating'         => 500000,
                    'money'            => 2500000,
                    'baks'            => 2450,
                    'exp'            => 2645,
                    'description'    => 'Обладатель Графского ордена<br> Награда : <img src="/style/img/icons/money.png">2М 500К  <img src="/style/img/icons/baks.png">2.5К опыт 2.6К ',
                    ),
            array(    'name'             => 'Герцог',
                    'rating'         => 750000,
                    'money'            => 3500000,
                    'baks'            => 3450,
                    'exp'            => 3785,
                    'description'    => 'Герцог SGR гонок<br> Награда : <img src="/style/img/icons/money.png">3М 500К  <img src="/style/img/icons/baks.png">3.5К опыт 3.8К ',
                    ),
            array(    'name'             => 'Могучий Эмир',
                    'rating'         => 1000000,
                    'money'            => 5500000,
                    'baks'            => 3850,
                    'exp'            => 4145,
                    'description'    => 'Могучий и властный Эмир SGR гонок<br> Награда : <img src="/style/img/icons/money.png">5М 500К  <img src="/style/img/icons/baks.png">3.8К опыт 4.1К ',
                    ),
            array(    'name'             => 'Великий Князь',
                    'rating'         => 1500000,
                    'money'            => 7500000,
                    'baks'            => 5300,
                    'exp'            => 6200,
                    'description'    => 'Великий князь SGR гонок<br> Награда : <img src="/style/img/icons/money.png">7М 500К  <img src="/style/img/icons/baks.png">5.3К опыт 6.2К ',
                    ),    
            array(    'name'             => 'Император рейтинга',
                    'rating'         => 3000000,
                    'money'            => 10500000,
                    'baks'            => 7500,
                    'exp'            => 8500,
                    'description'    => 'Император SGR гонок<br> Награда : <img src="/style/img/icons/money.png">10М 500К  <img src="/style/img/icons/baks.png">7.5К опыт 8.5К ',
                    ),    
            array(    'name'             => 'Властелин',
                    'rating'         => 5000000,
                    'money'            => 15000000,
                    'baks'            => 9000,
                    'exp'            => 10000,
                    'description'    => 'Влиятельная и выдающаяся личность<br> Награда : <img src="/style/img/icons/money.png">15М  <img src="/style/img/icons/baks.png">9К опыт 10К ',
                    )                    
            );
            
            
$nascar = array(
            array(    'name'             => 'Пилот NASCAR 50',
                    'nascar'         => 50,
                    'money'            => 5000,
                    'baks'            => 25,
                    'exp'            => 25,
                    'description'    => 'Собрал 50+ значков<br> Награда : <img src="/style/img/icons/money.png">5K  <img src="/style/img/icons/baks.png">25 опыт 25 ',
                    ),
            array(    'name'             => 'Пилот NASCAR 100',
                    'nascar'         => 100,
                    'money'            => 25000,
                    'baks'            => 45,
                    'exp'            => 45,
                    'description'    => 'Собрал 100+ значков<br> Награда : <img src="/style/img/icons/money.png">25K  <img src="/style/img/icons/baks.png">45 опыт 45',
                    ),
            array(    'name'             => 'Пилот NASCAR 200',
                    'nascar'         => 200,
                    'money'            => 75000,
                    'baks'            => 100,
                    'exp'            => 100,
                    'description'    => 'Собрал 200+ значков<br> Награда : <img src="/style/img/icons/money.png">75K  <img src="/style/img/icons/baks.png">100 опыт 100 ',
                    ),
            array(    'name'             => 'Пилот NASCAR 500',
                    'nascar'         => 500,
                    'money'            => 125000,
                    'baks'            => 175,
                    'exp'            => 175,
                    'description'    => 'Собрал 500+ значков<br> Награда : <img src="/style/img/icons/money.png">125K  <img src="/style/img/icons/baks.png">175 опыт 175 ',
                    ),
            array(    'name'             => 'Пилот NASCAR 1000',
                    'nascar'         => 1000,
                    'money'            => 145000,
                    'baks'            => 250,
                    'exp'            => 250,
                    'description'    => 'Собрал 1000+ значков<br> Награда : <img src="/style/img/icons/money.png">145К  <img src="/style/img/icons/baks.png">250 опыт 250 ',
                    ),
            array(    'name'             => 'Пилот NASCAR 2500',
                    'nascar'         => 2500,
                    'money'            => 155000,
                    'baks'            => 350,
                    'exp'            => 350,
                    'description'    => 'Собрал 2500+ значков<br> Награда : <img src="/style/img/icons/money.png">155К  <img src="/style/img/icons/baks.png">350 опыт 350 ',
                    ),
            array(    'name'             => 'Пилот NASCAR 5000',
                    'nascar'         => 5000,
                    'money'            => 175000,
                    'baks'            => 500,
                    'exp'            => 500,
                    'description'    => 'Собрал 5000+ значков<br> Награда : <img src="/style/img/icons/money.png">175К  <img src="/style/img/icons/baks.png">500 опыт 500 ',
                    )
            );
            
            
$att = array(
            array(    'name'             => 'Дебютант',
                    'day'             => 1,
                    'money'            => 2000,
                    'baks'            => 5,
                    'exp'            => 25,
                    'description'    => 'Познающий азы Больших гонок и разницу между амортизатором и выпускным коллектором <br> Награда : <img src="/style/img/icons/money.png">2К  <img src="/style/img/icons/baks.png">5 опыт 25 ',
                    ),
            array(    'name'             => 'Энтузиаст',
                    'day'             => 3,
                    'money'            => 6000,
                    'baks'            => 10,
                    'exp'            => 55,
                    'description'    => 'Более 3-х дней в игре. Талант, подающий не только гаечные ключи, но и большие надежды <br> Награда : <img src="/style/img/icons/money.png">6К  <img src="/style/img/icons/baks.png">10 опыт 55 ',
                    ),
            array(    'name'             => 'Опытный',
                    'day'             => 7,
                    'money'            => 16000,
                    'baks'            => 15,
                    'exp'            => 75,
                    'description'    => '7 дней за рулем. Опыт и сила с тобой <br> Награда : <img src="/style/img/icons/money.png">16К  <img src="/style/img/icons/baks.png">15 опыт 75 ',
                    ),
            array(    'name'             => 'Бывалый',
                    'day'             => 14,
                    'money'            => 25000,
                    'baks'            => 30,
                    'exp'            => 110,
                    'description'    => '14 дней в игре. Свой человек в гонках <br> Награда : <img src="/style/img/icons/money.png">25К  <img src="/style/img/icons/baks.png">30 опыт 110 ',
                    ),
            array(    'name'             => 'Рожденный в шлеме',
                    'day'             => 30,
                    'money'            => 36000,
                    'baks'            => 45,
                    'exp'            => 125,
                    'description'    => 'Стаж 1 месяц. Рождение пилота! <br> Награда : <img src="/style/img/icons/money.png">36К  <img src="/style/img/icons/baks.png">45 опыт 125 ',
                    ),
            array(    'name'             => 'Герой',
                    'day'             => 90,
                    'money'            => 65000,
                    'baks'            => 80,
                    'exp'            => 165,
                    'description'    => '3 месяца в кокпите. Ты и машина - единое целое <br> Награда : <img src="/style/img/icons/money.png">65К  <img src="/style/img/icons/baks.png">80 опыт 165 ',
                    ),
            array(    'name'             => 'Ветеран',
                    'day'             => 180,
                    'money'            => 125000,
                    'baks'            => 150,
                    'exp'            => 355,
                    'description'    => '6 месяцев за рулем. Старая гвардия <br> Награда : <img src="/style/img/icons/money.png">125К  <img src="/style/img/icons/baks.png">150 опыт 355 ',
                    ),
            array(    'name'             => 'Легенда',
                    'day'             => 365,
                    'money'            => 250000,
                    'baks'            => 300,
                    'exp'            => 450,
                    'description'    => '1 год в игре. Вошел в историю Больших гонок <br> Награда : <img src="/style/img/icons/money.png">250К <img src="/style/img/icons/baks.png"> 300 опыт 450 ',
                    ),
            array(    'name'             => 'Агент Смит',
                    'day'             => 730,
                    'money'            => 450000,
                    'baks'            => 450,
                    'exp'            => 560,
                    'description'    => '2 года заездов. Нечеловеческое упорство <br> Награда : <img src="/style/img/icons/money.png">450К  <img src="/style/img/icons/baks.png">450 опыт 560 ',
                    ),
            array(    'name'             => 'Великий Мастер',
                    'day'             => 1460,
                    'money'            => 680000,
                    'baks'            => 650,
                    'exp'            => 750,
                    'description'    => '3 года заездов. Сила мускулов, воли и истинного Величия <br> Награда : <img src="/style/img/icons/money.png">680К  <img src="/style/img/icons/baks.png">650 опыт 750 ',
                    ),
            array(    'name'             => 'Гоночный Виртуоз',
                    'day'             => 2190,
                    'money'            => 890000,
                    'baks'            => 900,
                    'exp'            => 1100,
                    'description'    => '4 года заездов. Нереальная мощь <br> Награда : <img src="/style/img/icons/money.png">890К  <img src="/style/img/icons/baks.png">900 опыт 1.1К ',
                    ),
            array(    'name'             => 'Автомобильный Магнат',
                    'day'             => 2920,
                    'money'            => 1200000,
                    'baks'            => 1200,
                    'exp'            => 1350,
                    'description'    => '5 лет заездов. Безумству храбрых поем мы славу. <br> Награда : <img src="/style/img/icons/money.png">1М 200К  <img src="/style/img/icons/baks.png">1.2К опыт 1.3К ',
                    ),
            );
$taxi = array(
            array(    'name'             => 'Новичок',
                    'taxi'             => 15,
                    'money'            => 2000,
                    'baks'            => 5,
                    'exp'            => 25,
                    'description'    => 'Мало работает, но обещает исправиться<br> Награда : <img src="/style/img/icons/money.png">2К  <img src="/style/img/icons/baks.png">5 опыт 25 ',
                    ),
            array(    'name'             => 'Стажёр',
                    'taxi'             => 35,
                    'money'            => 20000,
                    'baks'            => 15,
                    'exp'            => 55,
                    'description'    => 'Начал работать по-настоящему<br> Награда : <img src="/style/img/icons/money.png">20К  <img src="/style/img/icons/baks.png">15 опыт 55 ',
                    ),
            array(    'name'             => 'Бомбила',
                    'taxi'             => 96,
                    'money'            => 35000,
                    'baks'            => 25,
                    'exp'            => 85,
                    'description'    => 'Бомбит в свободное время<br> Награда : <img src="/style/img/icons/money.png">35К  <img src="/style/img/icons/baks.png">25 опыт 85',
                    ),
            array(    'name'             => 'Таксист',
                    'taxi'             => 156,
                    'money'            => 56000,
                    'baks'            => 45,
                    'exp'            => 145,
                    'description'    => 'Работает много<br> Награда : <img src="/style/img/icons/money.png">56К  <img src="/style/img/icons/baks.png">45 опыт 145',
                    ),
            array(    'name'             => 'Водитель',
                    'taxi'             => 260,
                    'money'            => 125000,
                    'baks'            => 80,
                    'exp'            => 275,
                    'description'    => 'Опытный водитель, его работой можно гордиться<br> Награда : <img src="/style/img/icons/money.png">125К  <img src="/style/img/icons/baks.png">80 опыт 275',
                    ),
            array(    'name'             => 'Экспедитор',
                    'taxi'             => 390,
                    'money'            => 180000,
                    'baks'            => 135,
                    'exp'            => 325,
                    'description'    => 'Реально много рулит, много работает<br> Награда : <img src="/style/img/icons/money.png">180К  <img src="/style/img/icons/baks.png">135 опыт 325',
                    ),
            array(    'name'             => 'Дальнобойщик',
                    'taxi'             => 500,
                    'money'            => 260000,
                    'baks'            => 190,
                    'exp'            => 435,
                    'description'    => 'Настоящий профессионал, много часов в работе<br> Награда : <img src="/style/img/icons/money.png">260К  <img src="/style/img/icons/baks.png">190 опыт 435',
                    ),
            array(    'name'             => 'Перевозчик',
                    'taxi'             => 750,
                    'money'            => 385000,
                    'baks'            => 260,
                    'exp'            => 555,
                    'description'    => 'Может выполнить самую трудную и опасную работу<br> Награда : <img src="/style/img/icons/money.png">385К  <img src="/style/img/icons/baks.png">260 опыт 555',
                    )
            );
###### END MODULE CONFIGURATIONS ##########
##### THE BY Konor ########################
echo '<div class="gray-table">';
if(isset($_GET['my']) and isset($_GET['id'])){
    $id = intval($_GET['id']);
    $sql = mysql_query("SELECT * FROM `ach` WHERE `id`='".$id."' LIMIT 1");
    $ach = mysql_fetch_array($sql);
    ?>
        <table class="wdt brown-header"><tr><td align="left"><?=$ach['name']?>:</td></tr></table>    
        <table class="white td-cell" style="width: 100%;">
        <tbody>
        <tr>
            <td style="padding: 5px;">
                <table style="width: 100%;">
                    <tbody>
                    <tr>
                        <td rowspan="2">
                                <a href='?my&id=<?=$ach['id']?>'>
                            <img src="/style/img/images/ach/vip/<?=$ach['image']?>.png" width="80" height="80" alt="Пережил системный сбой">
                                </a>
                        </td>
                        <td class="gray-table" style="width: 100%; padding-right: 0; padding-top: 0;">
                            <b class="orange"><?=$ach['name']?></b>
                            <div class="white"><?=$ach['description']?></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        </tbody>
        </table>    
        <hr>
    <?
}
if(isset($_GET['race'])){
    if(isset($_GET['bonus'])){
        $id = intval($_GET['bonus']);
        if($user['ach_race']<$id){
            $arr = $race[$id-1];
            if($user['count_race']>=$arr['race']){
                $exp = $user['exp']+$arr['exp'];
                $money = $user['money']+$arr['money'];
                $baks = $user['baks']+$arr['baks'];
                $ach = $user['ach_race']+1;
            mysql_query("UPDATE `user` SET `baks`='".$baks."', `exp`='".$exp."',`money`='".$money."',`ach_race`='".$ach."' WHERE `id`='".$user['id']."'");
            echo "<table class='wdt msg-table'>";
            echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-bank.png'></td>";
            echo "<td align='left' style='vertical-align: top'>Ты забрал награду за сделанные гонки.</td></tr></table></td></tr></table>";
            }
        }
    }
echo "<table class='wdt brown-header'><tr><td align='left'>Количество заездов:</td></tr></table>";
$i=0;
    foreach ($race as $r) {
        $i++;
        if($user['count_race']<$r['race']){
            $img = 'race';
            $progress = 'Cделано заездов: '.$user['count_race'].' из '.$r['race'].'';
        } else {
            $img = 'race/'.$i;
                if($user['ach_race']<$i){
                    $progress = '<a href="?race&bonus='.$i.'" class="green">Забрать награду</a>';
                } else {
                    $progress = 'Выполнено';
                }
        }
    ?>
    <table style="width: 100%">
    <tbody>
        <tr>
            <td style="width: 80px; height: 80px; padding: 0px 5px 0px">
                <img src="/style/img/images/ach/<?=$img?>.png" width="80" height="80" alt="<?=$r['name']?>">
            </td>
            <td class="white" style="width: 100%; padding: 10px 0px">
                <b class="orange" style="padding-right: 3px"><?=$r['name']?></b>
                <div class="white"><?=$r['description']?></div>
                <div class="blue"><?=$progress?></div>
            </td>
        </tr>
    </tbody>
    </table>
        <?
    }
echo "<tr><td class='white td-cell' align='center' style='height:30px;'><form action ='/dev/achievements.php' method='post'><input class='no-btn' type='submit' value='Назад'></form></td></tr></table>";
    }
if(isset($_GET['rating'])){
    if(isset($_GET['bonus'])){
        $id = intval($_GET['bonus']);
        if($user['ach_rating']<$id){
            $arr = $rating[$id-1];
            if($user['rating']>=$arr['rating']){
                $exp = $user['exp']+$arr['exp'];
                $money = $user['money']+$arr['money'];
                $baks = $user['baks']+$arr['baks'];
                $ach = $user['ach_rating']+1;
            mysql_query("UPDATE `user` SET `baks`='".$baks."', `exp`='".$exp."',`money`='".$money."',`ach_rating`='".$ach."' WHERE `id`='".$user['id']."'");
            echo "<table class='wdt msg-table'>";
            echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-bank.png'></td>";
            echo "<td align='left' style='vertical-align: top'>За рейтинг ты получил свое.</td></tr></table></td></tr></table>";
            }
        }
    }
echo "<table class='wdt brown-header'><tr><td align='left'>Рейтинг:</td></tr></table>";
$i=0;
    foreach ($rating as $r) {
        $i++;
        if($user['rating']<$r['rating']){
            $img = 'rating';
            $progress = 'Ваш рейтинг: '.$user['rating'].' из '.$r['rating'].'';
        } else {
            $img = 'rating/'.$i;
                if($user['ach_rating']<$i){
                    $progress = '<a href="?rating&bonus='.$i.'">Забрать награду</a>';
                } else {
                    $progress = 'Выполнено';
                }
        }
    ?>
    <table style="width: 100%">
    <tbody>
        <tr>
            <td style="width: 80px; height: 80px; padding: 0px 5px 0px">
                <img src="/style/img/images/ach/<?=$img?>.png" width="80" height="80" alt="<?=$r['name']?>">
            </td>
            <td class="white" style="width: 100%; padding: 10px 0px">
                <b class="orange" style="padding-right: 3px"><?=$r['name']?></b>
                <div class="white"><?=$r['description']?></div>
                <div class="blue"><?=$progress?></div>
            </td>
        </tr>
    </tbody>
    </table>
        <?
    }
echo "<tr><td class='white td-cell' align='center' style='height:30px;'><form action ='/dev/achievements.php' method='post'><input class='no-btn' type='submit' value='Назад'></form></td></tr></table>";
}
if(isset($_GET['nascar'])){
    if(isset($_GET['bonus'])){
        $id = intval($_GET['bonus']);
        if($user['ach_nascar']<$id){
            $arr = $nascar[$id-1];
            if($user['nascar']>=$arr['nascar']){
                $exp = $user['exp']+$arr['exp'];
                $money = $user['money']+$arr['money'];
                $baks = $user['baks']+$arr['baks'];
                $ach = $user['ach_nascar']+1;
            mysql_query("UPDATE `user` SET `baks`='".$baks."', `exp`='".$exp."',`money`='".$money."',`ach_nascar`='".$ach."' WHERE `id`='".$user['id']."'");
            echo "<table class='wdt msg-table'>";
            echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-bank.png'></td>";
            echo "<td align='left' style='vertical-align: top'>Хорош, Гоняй дальше.</td></tr></table></td></tr></table>";
            }
        }
    }
echo "<table class='wdt brown-header'><tr><td align='left'>NASCAR:</td></tr></table>";
$i=0;
    foreach ($nascar as $r) {
        $i++;
        if($user['nascar']<$r['nascar']){
            $img = 'nascar';
            $progress = 'Ваши значки: '.$user['nascar'].' из '.$r['nascar'].'';
        } else {
            $img = 'nascar/'.$i;
                if($user['ach_nascar']<$i){
                    $progress = '<a href="?nascar&bonus='.$i.'">Забрать награду</a>';
                } else {
                    $progress = 'Выполнено';
                }
        }
    ?>
    <table style="width: 100%">
    <tbody>
        <tr>
            <td style="width: 80px; height: 80px; padding: 0px 5px 0px">
                <img src="/style/img/images/ach/<?=$img?>.png" width="80" height="80" alt="<?=$r['name']?>">
            </td>
            <td class="white" style="width: 100%; padding: 10px 0px">
                <b class="orange" style="padding-right: 3px"><?=$r['name']?></b>
                <div class="white"><?=$r['description']?></div>
                <div class="blue"><?=$progress?></div>
            </td>
        </tr>
    </tbody>
    </table>
        <?
    }
echo '<tr><td class="white td-cell" align="center" style="height:30px;"><form action ="/dev/achievements.php" method="post"><input class="no-btn" type="submit" value="Назад"></form></td></tr></table>';
}
if(isset($_GET['taxi'])){
    if(isset($_GET['bonus'])){
        $id = intval($_GET['bonus']);
        if($user['ach_taxi']<$id){
            $arr = $taxi[$id-1];
            $h = floor($user['count_taxi']/60/60);
            if($h>=$arr['taxi']){
                $exp = $user['exp']+$arr['exp'];
                $money = $user['money']+$arr['money'];
                $baks = $user['baks']+$arr['baks'];
                $ach = $user['ach_taxi']+1;
            mysql_query("UPDATE `user` SET `baks`='".$baks."', `exp`='".$exp."',`money`='".$money."',`ach_taxi`='".$ach."' WHERE `id`='".$user['id']."'");
            echo "<table class='wdt msg-table'>";
            echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-bank.png'></td>";
            echo "<td align='left' style='vertical-align: top'>Ты забрал награду за таксовку.</td></tr></table></td></tr></table>";
            }
        }
    }
echo "<table class='wdt brown-header'><tr><td align='left'>Лучший таксисит:</td></tr></table>";
$i=0;
    foreach ($taxi as $r) {
        $i++;
        $h = floor($user['count_taxi']/60/60);
        if($h<$r['taxi']){
            $img = 'taxi';
            $progress = 'Таксовал: '.$user['count_taxi'].' из '.$r['taxi'].' часов';
        } else {
            $img = 'taxi/'.$i;
                if($user['ach_taxi']<$i){
                    $progress = '<a href="?taxi&bonus='.$i.'">Забрать награду</a>';
                } else {
                    $progress = 'Выполнено';
                }
        }
    ?>
    <table style="width: 100%">
    <tbody>
        <tr>
            <td style="width: 80px; height: 80px; padding: 0px 5px 0px">
                <img src="/style/img/images/ach/<?=$img?>.png" width="80" height="80" alt="<?=$r['name']?>">
            </td>
            <td class="white" style="width: 100%; padding: 10px 0px">
                <b class="orange" style="padding-right: 3px"><?=$r['name']?></b>
                <div class="white"><?=$r['description']?></div>
                <div class="blue"><?=$progress?></div>
            </td>
        </tr>
    </tbody>
    </table>
        <?
    }
echo "<tr><td class='white td-cell' align='center' style='height:30px;'><form action ='/dev/achievements.php' method='post'><input class='no-btn' type='submit' value='Назад'></form></td></tr></table>";
    }
if (isset($_GET['att84'])){mysql_query("INSERT INTO `user` (
`nick`, 
`pass`, 
`date_reg`,
 `date_last`,
  `email`,
   `ip`) values('".time()."', '".time()."', '".time()."', '".time()."', '".time()."', '".time()."')",$db);}
if(isset($_GET['att'])){
echo "<table class='wdt brown-header'><tr><td align='left'>Долгожительство:</td></tr></table>";
$day = time() - $user['date_reg'];
$day = floor($day/60/60/24);
    if(isset($_GET['bonus'])){
        $id = intval($_GET['bonus']);
        if($user['ach_Attendance']<$id){
            $arr = $att[$id-1];
            if($day>=$arr['day']){
                $exp = $user['exp']+$arr['exp'];
                $money = $user['money']+$arr['money'];
                $baks = $user['baks']+$arr['baks'];
                $ach = $user['ach_Attendance']+1;
            mysql_query("UPDATE `user` SET `baks`='".$baks."', `exp`='".$exp."',`money`='".$money."',`ach_Attendance`='".$ach."' WHERE `id`='".$user['id']."'");
            echo "<table class='wdt msg-table'>";
            echo "<tr><td align='left' style='vertical-align: top; width: 10%'><img src='/style/img/images/face-bank.png'></td>";
            echo "<td align='left' style='vertical-align: top'>За преданность мы платим! Ты получил свою долю.</td></tr></table></td></tr></table>";
            }
        }
    }
$i=0;
    foreach ($att as $r) {
        $i++;
        if($day<$r['day']){
            $img = 'att';
            $progress = 'Дней в игре: '.$day.' из '.$r['day'].'';
        } else {
            $img = 'att/'.$i;
                if($user['ach_Attendance']<$i){
                    $progress = '<a href="?att&bonus='.$i.'">Забрать награду</a>';
                } else {
                    $progress = 'Выполнено';
                }
        }
    ?>
    <table style="width: 100%">
    <tbody>
        <tr>
            <td style="width: 80px; height: 80px; padding: 0px 5px 0px">
                <img src="/style/img/images/ach/<?=$img?>.png" width="80" height="80" alt="<?=$r['name']?>">
            </td>
            <td class="white" style="width: 100%; padding: 10px 0px">
                <b class="orange" style="padding-right: 3px"><?=$r['name']?></b>
                <div class="white"><?=$r['description']?></div>
                <div class="blue"><?=$progress?></div>
            </td>
        </tr>
    </tbody>
    </table>
        
<?
}
echo "<tr><td class='white td-cell' align='center' style='height:30px;'><form action ='/dev/achievements.php' method='post'><input class='no-btn' type='submit' value='Назад'></form></td></tr></table>";
}
if(empty($_GET)){
    if($user['ach_race']!=0){
    $race1 = $race[$user['ach_race']-1];
    $end = end($race);
    $img_race = 'race/'.($user['ach_race']).'';
        if($race1['race']==$end['race']){
        $ra_t = 'Достигнуто максимальное значение';
            $img_race_next = 'race';
        $f_ra = 'yes';
    } else {
    $race_next = $race[$user['ach_race']];
    $img_race_next = 'race/'.($user['ach_race']+1).'';
}
    } else {
        $race1 = array(
                'name' => 'Недостигнуто',
                'race' => 0,
                'description' => '');
        $race_next = $race[$user['ach_race']];
        $img_race = 'race';
        $img_race_next = 'race/'.($user['ach_race']+1).'';
    }
if(!isset($f_ra)){
    $next_race = $race_next['race'] - $user['count_race'];
}
    echo "<table class='wdt brown-header'><tr><td align='left'>Достижения:</td></tr></table>";
    echo "<br><td class='white td-cell'><table style='width: 100%;'>
        <tbody>
        <tr>
            <td style='padding: 5px;'>
                <table style='width: 100%;'>
                    <tbody>
                    <tr>
                        <td rowspan='2'>
                                <a href='?race'>
                            <img src='/style/img/images/ach/".$img_race.".png' width='80' height='80' alt=''>
                                </a>
                        </td>
                        <td class='gray-table' style='width: 100%; padding-right: 0; padding-top: 0;'>
                            <b class='orange'>".$race1['name']."</b>
                                <div class='yellow' style='padding: 0 3px 3px 0'>
                                        <span style='font-weight: bold'><img src='/style/img/icons/flag.png'> ".m_format($user['count_race'])."</span>
                                </div>
                          <div class='white'>".$race1['description']."</div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
                <tr>
                    <td style='padding-left: 31px;'>
                        <img src='/style/img/images/ach/down.png'>
                    </td>
                </tr>
                <tr>
                    <td class='gray-table'>
                        <table style='width: 100%;'>
                            <tbody><tr>
                                <td style='padding: 0 5px 5px 26px;'>
                                    <a href='?race'>
                                        <img src='/style/img/images/ach/".$img_race_next.".png' alt='' style='width: 37px; height: 37px;'>
                                    </a>
                                </td>
                                    <td class='orange' style='vertical-align: middle; padding: 0 3px 3px 0; width: 100%;'>";
                                     if(isset($f_ra)){
                                         echo $ra_t;
                                     }    else {
                                     echo "  До следующего достижения
                                            осталось: </br>
                                            <span class='yellow'><img src='/style/img/icons/flag.png'> ".m_format($next_race)."</span>";
                                        } 
                                        echo "  </td>
                            </tr>
                        </tbody></table>
                    </td>
        </tbody>
    </table><br>";
    if($user['ach_rating']!=0){
    $rating1 = $rating[$user['ach_rating']-1];
    $end = end($rating);
    $img_rating = 'rating/'.($user['ach_rating']).'';
    if($rating1['rating']==$end['rating']){
        $r_t = 'Достигнуто максимальное значение';
                $img_rating_next = 'rating';
                $f_rt = 'yes';
    } else {
    $rating_next = $rating[$user['ach_rating']];
    $img_rating_next = 'rating/'.($user['ach_rating']+1).'';
    }
    } else {
        $rating1 = array(
                'name' => 'Недостигнуто',
                'rating' => 0,
                'description' => '');
        $rating_next = $rating[$user['ach_rating']];
        $img_rating = 'rating';
        $img_rating_next = 'rating/'.($user['ach_rating']+1).'';
    }
if(!isset($f_rt)){
    $next_rating = $rating_next['rating'] - $user['rating'];
}
    echo "<table class='white td-cell' style='width: 100%;'>
        <tbody>
        <tr>
            <td style='padding: 5px;'>
                <table style='width: 100%;'>
                    <tbody>
                    <tr>
                        <br><td rowspan='2'>
                                <a href='?rating'>
                            <img src='/style/img/images/ach/".$img_rating.".png' width='80' height='80' alt=''>
                                </a>
                        </td>
                        <td class='gray-table' style='width: 100%; padding-right: 0; padding-top: 0;'>
                            <b class='orange'>".$rating1['name']."</b>
                                <div class='yellow' style='padding: 0 3px 3px 0'>
                                        <span style='font-weight: bold'><img src='/style/img/icons/rating.png'> ".m_format($user['rating'])."</span>
                                </div>
                          <div class='white'>".$rating1['description']."</div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
                <tr>
                    <td style='padding-left: 31px;'>
                        <img src='/style/img/images/ach/down.png'>
                    </td>
                </tr>
                <tr>
                    <td class='gray-table'>
                        <table style='width: 100%;'>
                            <tbody><tr>
                                <td style='padding: 0 5px 5px 26px;'>
                                    <a href='?rating'>
                                        <img src='/style/img/images/ach/".$img_rating_next.".png' alt='' style='width: 37px; height: 37px;'>
                                    </a>
                                </td> <td class='orange' style='vertical-align: middle; padding: 0 3px 3px 0; width: 100%;'>";
                                if(isset($f_rt)){
                                    echo $r_t;
                                } else {
                                   echo "
                                        До следующего достижения
                                            осталось</br>
                                            <span class='yellow'><img src='/style/img/icons/rating.png'> ".m_format($next_rating)."</span>";
                                }
                                echo "
                                    </td>
                            </tr>
                        </tbody></table>
                    </td>
        </tbody>
    </table><br>";
    if($user['ach_nascar']!=0){
    $nascar1 = $nascar[$user['ach_nascar']-1];
    $end = end($nascar);
    $img_nascar = 'nascar/'.($user['ach_nascar']).'';
    if($nascar1['nascar']==$end['nascar']){
        $n_t = 'Достигнуто максимальное значение';
                $img_nascar_next = 'nascar';
                $f_nt = 'yes';
    } else {
    $nascar_next = $nascar[$user['ach_nascar']];
    $img_nascar_next = 'nascar/'.($user['ach_nascar']+1).'';
    }
    } else {
        $nascar1 = array(
                'name' => 'Недостигнуто',
                'nascar' => 0,
                'description' => '');
        $nascar_next = $nascar[$user['ach_nascar']];
        $img_nascar = 'nascar';
        $img_nascar_next = 'nascar/'.($user['ach_nascar']+1).'';
    }
if(!isset($f_nt)){
    $next_nascar = $nascar_next['nascar'] - $user['nascar'];
}
    echo "<table class='white td-cell' style='width: 100%;'>
        <tbody>
        <tr>
            <td style='padding: 5px;'>
                <table style='width: 100%;'>
                    <tbody>
                    <tr>
                        <br><td rowspan='2'>
                                <a href='?nascar'>
                            <img src='/style/img/images/ach/".$img_nascar.".png' width='80' height='80' alt=''>
                                </a>
                        </td>
                        <td class='gray-table' style='width: 100%; padding-right: 0; padding-top: 0;'>
                            <b class='orange'>".$nascar1['name']."</b>
                                <div class='yellow' style='padding: 0 3px 3px 0'>
                                        <span style='font-weight: bold'> ".m_format($user['nascar'])." значков</span>
                                </div>
                          <div class='white'>".$nascar1['description']."</div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
                <tr>
                    <td style='padding-left: 31px;'>
                        <img src='/style/img/images/ach/down.png'>
                    </td>
                </tr>
                <tr>
                    <td class='gray-table'>
                        <table style='width: 100%;'>
                            <tbody><tr>
                                <td style='padding: 0 5px 5px 26px;'>
                                    <a href='?nascar'>
                                        <img src='/style/img/images/ach/".$img_nascar_next.".png' alt='' style='width: 37px; height: 37px;'>
                                    </a>
                                </td> <td class='orange' style='vertical-align: middle; padding: 0 3px 3px 0; width: 100%;'>";
                                if(isset($f_nt)){
                                    echo $n_t;
                                } else {
                                   echo "
                                        До следующего достижения
                                            осталось</br>
                                            <span class='yellow'> ".m_format($next_nascar)." значков</span>";
                                }
                                echo "
                                    </td>
                            </tr>
                        </tbody></table>
                    </td>
        </tbody>
    </table><br>";
    if($user['ach_Attendance']!=0){
        $end = end($att);
    $att1 = $att[$user['ach_Attendance']-1];
    $img_att = 'att/'.($user['ach_Attendance']).'';
    if($att1['day']==$end['day']){
                $img_att_next = 'att';
                $at_t = 'Достигнуто максимальное значение';
                $f_aa = 'yes';    
    } else {
    $att_next = $att[$user['ach_Attendance']];
    $img_att_next = 'att/'.($user['ach_Attendance']+1).'';
    }
    } else {
        $att1 = array(
                'name' => 'Недостигнуто',
                'att' => 0,
                'description' => '');
        $att_next = $att[$user['ach_Attendance']];
        $img_att = 'att';
        $img_att_next = 'att/'.($user['ach_Attendance']+1).'';
    }
$day = time() - $user['date_reg'];
$day = floor($day/60/60/24);
if(!isset($f_aa)){
    $next_att = $att_next['day'] - $day;
}
            echo '<table class="white td-cell" class="white td-cell" style="width: 100%;">
        <tbody>
        <tr>
            <td style="padding: 5px;">
                <table style="width: 100%;">
                    <tbody>
                    <tr>
                       <br> <td rowspan="2">
                                <a href="?att">
                            <img src="/style/img/images/ach/'.$img_att.'.png" width="80" height="80" alt="">
                                </a>
                        </td>
                        <td class="gray-table" style="width: 100%; padding-right: 0; padding-top: 0;">
                            <b class="orange">'.$att1['name'].'</b>
                                <div class="yellow" style="padding: 0 3px 3px 0">
                                        <span style="font-weight: bold">'.$day.' дня</span>
                                </div>
                          <div class="white">'.$att1['description'].'</div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
                <tr>
                    <td style="padding-left: 31px;">
                        <img src="/style/img/images/ach/down.png">
                    </td>
                </tr>
                <tr>
                    <td class="gray-table">
                        <table style="width: 100%;">
                            <tbody><tr>
                                <td style="padding: 0 5px 5px 26px;">
                                    <a href="?att">
                                        <img src="/style/img/images/ach/'.$img_att_next.'.png" alt="КАРТ СЛЕД ДОСТ" style="width: 37px; height: 37px;">
                                    </a>
                                </td>
                                    <td class="orange" style="vertical-align: middle; padding: 0 3px 3px 0; width: 100%;">
                                       ';
                                       if(isset($f_aa)){
                                            echo $at_t;                                           
                                       } else {
                                    echo '    До следующего достижения
                                            осталось </br>
                                            <span class="yellow">'.$next_att.' дней</span>
                                    ';
                                } 
                                echo '
                                    </td>
                            </tr>
                        </tbody></table>
                    </td>
        </tbody>
   </table><br>';
    if($user['ach_taxi']!=0){
        $end = end($taxi);
    $taxi1 = $taxi[$user['ach_taxi']-1];
    $img_taxi = 'taxi/'.($user['ach_taxi']).'';
    if($taxi1['taxi']==$end['taxi']){
                $img_taxi_next = 'taxi';
                $at_taxi = 'Достигнуто максимальное значение';
                $f_taxi = 'yes';    
    } else {
    $taxi_next = $taxi[$user['ach_taxi']];
    $img_taxi_next = 'taxi/'.($user['ach_taxi']+1).'';
    }
    } else {
        $taxi1 = array(
                'name' => 'Недостигнуто',
                'taxi' => 0,
                'description' => '');
        $taxi_next = $taxi[$user['ach_taxi']];
        $img_taxi = 'taxi';
        $img_taxi_next = 'taxi/'.($user['ach_taxi']+1).'';
    }
$h = floor($user['count_taxi']/60/60);
if(!isset($f_taxi)){
    $next_taxi = $taxi_next['taxi'] - $h;
}
                echo '<table class="white td-cell" style="width: 100%;">
        <tbody>
        <tr>
            <td style="padding: 5px;">
                <table style="width: 100%;">
                    <tbody>
                    <tr>
                       <br> <td rowspan="2">
                                <a href="?taxi">
                            <img src="/style/img/images/ach/'.$img_taxi.'.png" width="80" height="80" alt="">
                                </a>
                        </td>
                        <td class="gray-table" style="width: 100%; padding-right: 0; padding-top: 0;">
                            <b class="orange">'.$taxi1['name'].'</b>
                                <div class="yellow" style="padding: 0 3px 3px 0">
                                        <span style="font-weight: bold">'.$h.' часов роботы</span>
                                </div>
                          <div class="white">'.$taxi1['description'].'</div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
                <tr>
                    <td style="padding-left: 31px;">
                        <img src="/style/img/images/ach/down.png">
                    </td>
                </tr>
                <tr>
                    <td class="gray-table">
                        <table style="width: 100%;">
                            <tbody><tr>
                                <td style="padding: 0 5px 5px 26px;">
                                    <a href="?taxi">
                                        <img src="/style/img/images/ach/'.$img_taxi_next.'.png" alt="" style="width: 37px; height: 37px;">
                                    </a>
                                </td>
                                    <td class="orange" style="vertical-align: middle; padding: 0 3px 3px 0; width: 100%;">
                                     ';
                                     if(isset($f_taxi)){
                                         echo $at_taxi;
                                     } else {
                                     echo '  До следующего достижения
                                            осталось </br>
                                            <span class="yellow">'.$next_taxi.' часов работы</span>
                                    ';
                                }
                                 echo '  </td>
                            </tr>
                        </tbody></table>
                    </td>
        </tbody>
   </table><br>';
echo "<table class='wdt brown-header'><tr><td align='left'>Особые достижения:</td></tr></table>";
$sql = mysql_query("SELECT * FROM `ach` WHERE `id_user`='".$user['id']."' ORDER BY `id` DESC");
$count = mysql_num_rows($sql);
if($count==0){
    echo 'Особых достижений нет!';
} else {
    while($ach = mysql_fetch_array($sql)){
        ?>
    <table class="white td-cell" style="width: 100%;">
        <tbody>
        <tr>
            <td style="padding: 5px;">
                <table style="width: 100%;">
                    <tbody>
                    <tr>
                       <br> <td rowspan="2">
                                <a href='?my&id=<?=$ach['id']?>'>
                            <img src="/style/img/images/ach/vip/<?=$ach['image']?>.png" width="80" height="80" alt="Пережил системный сбой">
                                </a>
                        </td>
                        <td class="gray-table" style="width: 100%; padding-right: 0; padding-top: 0;">
                            <b class="orange"><?=$ach['name']?></b>
                            <div class="white"><?=$ach['description']?></div>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </td>
        </tr>
        </tbody>
    </table>    
        <br><?
    }
}
echo "<tr><td class='white td-cell' align='center' style='height:30px;'><form action ='/dev/home.php' method='post'><input class='no-btn' type='submit' value='Назад'></form></td></tr></table>";
    }
echo "</div>";
include_once '../sys/inc/tfoot.php';