Вход Регистрация
Файл: ubiznes.mobi/inc/location/business/buy_works.php
Строк: 144
<?php
if(isset($_GET['buy_works']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `business_user` WHERE `id` = '".intval($_GET['buy_works'])."' AND `id_user` = '$user[id]' AND `id_bus` != '0'"),0)>0){
    
$work=mysql_fetch_assoc(mysql_query("SELECT * FROM `business_user` WHERE `id` = '".intval($_GET['buy_works'])."' LIMIT 1"));
    
$bus=mysql_fetch_assoc(mysql_query("SELECT * FROM `business` WHERE `id` = '$work[id_bus]' LIMIT 1"));
    
$bus_upgr=mysql_fetch_assoc(mysql_query("SELECT * FROM `business_user_upgr` WHERE `id_f` = '$work[id_bus]' AND `id_user` = '$user[id]' LIMIT 1"));
    if(empty(
$bus_upgr['level']))
        
$bus_upgr['level'] = 0;
    
$money=($work['works']*$bus['works_give'])*($bus['sell']+($bus_upgr['level']*100));
    echo
' <div class="b-top"> <span class="title"> '.hsc($bus['name']).' </span></div>';
    
?>
    <div class="b-bottom">
        <table style="width:100%" cellspacing="0" cellpadding="0" valign="top">
            <tbody>
            <tr>
                <td class="screen" width="20%" align="center">
                    <img width="38" height="38" src="inc/location/business/images/<?php echo ($work['id_bus']==0?'no_bus':$work['id_bus']); ?>.png" alt="">
                </td>
                <td width="80%">
                    <img src="https://biznesmen.mobi/img/style/rab.png" width="16" height="16"> <?php echo $work['works']; ?>
                    | <img src="https://biznesmen.mobi/img/style/plus.png" width="16" height="16"> <?php echo $bus_upgr['level']; ?><br/>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <?php
    
if(isset($_GET['go']) && $work['work']==0){
        
$count=abs(intval($_GET['go']));
        
$price_all=$count*$bus['price_works'];
        
$count_baks=intval((intval($work['works']+$count)/5)-intval($work['works']/5));
        
$count_money=$count-$count_baks;
        
$baks=$count_baks*100;
        
$money=$count_money*100;
        if(isset(
$_GET['ok'])){
            if(
$count<=0){$err=1err_game("Количество работников должно быть больше 0");}
            elseif(
$user['money']<$money){$err=1err_game('У Вас не хватает <img width="16" height="16" src="/images/icons/money.png"> <span class="title"> '.($money-$user['money']).' </span>');}
            elseif(
$user['baks']<$baks){$err=1err_game('У Вас не хватает <img width="16" height="16" src="/images/icons/baks.png"> <span class="title"> '.($baks-$user['baks']).' </span>');}
            if((
$work['works']+$count)>20){$err=1err_game("Максимальное кол-во работников в бизнесе <font color='lime'>20</font>");}
            if(empty(
$err)){
                
mysql_query("UPDATE `user` SET `money` = `money` - '$money',`baks` = `baks` - '$baks' WHERE `id` = '$user[id]'");
                
mysql_query("UPDATE `business_user` SET `works` = `works` + '$count' WHERE `id` = '$work[id]'");
                
$_SESSION['msg']="Работники успешно приобретены"header("location:/?business&buy_works=$work[id]"); exit;
            }
        }
        echo
'<div class="pan-4">
        Вы покупаете <span class="">'
.$count.'</span> работников</br>
        Стоимость: '
.($count_money>0?'<img width="16" height="16" src="/images/icons/money.png"> <span class="">'.($money).' </span> монет':null).
        '
.($count_baks>0?'<img width="16" height="16" src="/images/icons/baks.png"> <span class="">'.($baks).' </span> баксов':null).'  </div>'
        
podtv("/?business&buy_works=$work[id]&go=$count&ok","/?business&buy_works=$work[id]");
        include_once
'sys/foot.php';
    }
    if((
$work['works']+1)%5==0){$res="baks";}else{$res="money";}
    echo
'<div class="b-top"><h2> Купить работников </h2></div>';
    echo
'<div class="pan-4">
    Стоимость работника: <img width="16" height="16" src="/images/icons/'
.$res.'.png"> '.$bus['price_works'].'</br>
    '
.($res=="money"?'Каждый 5й работник: <img width="16" height="16" src="/images/icons/baks.png">'.$bus['price_works'].'</br>':null).'
    Рабоников в данном бизнесе:  <img src="https://biznesmen.mobi/img/style/rab.png" width="16" height="16"/> <font color="lime">'
.$work['works'].' </font></br>
    Максимальное кол-во работников:  <img src="https://biznesmen.mobi/img/style/rab.png" width="16" height="16"/> <font color="red"> 20 </font></div>
    '
.($work['work']==0?'
    <a href=/?business&buy_works='
.$work['id'].'&go=1><div class="pan-3">Купить 1-го <img src="https://biznesmen.mobi/img/style/rab.png" width="16" height="16"/> за ' $bus['price_works'] . ' <img src="/images/style/money.png" width="16" height="16"/> </div></a>
    <a href=/?business&buy_works='
.$work['id'].'&go=3><div class="pan-3">Купить 3-х <img src="https://biznesmen.mobi/img/style/rab.png" width="16" height="16"/> за ' . ($bus['price_works'] * 3) . ' <img src="/images/style/money.png" width="16" height="16"/> </div></a>
    <a href=/?business&buy_works='
.$work['id'].'&go=5><div class="pan-3">Купить 5-х <img src="https://biznesmen.mobi/img/style/rab.png" width="16" height="16"/> за ' . ($bus['price_works'] * 5) . ' <img src="/images/style/money.png" width="16" height="16"/> и 100<img src="/images/style/b.png" width="16" height="16"/>  </div></a>
    <a href=/?business&buy_works='
.$work['id'].'&go=10><div class="pan-3">Купить 10-х <img src="https://biznesmen.mobi/img/style/rab.png" width="16" height="16"/> за ' . ($bus['price_works'] * 10) . ' <img src="/images/style/money.png" width="16" height="16"/> и 200<img src="/images/style/b.png" width="16" height="16"/> </div></a>':'<div class="pan-3"> Пока идет работа, покупка работников не доступна</div>').'';
    
back('?business');
    include_once
'sys/foot.php';
}
Онлайн: 1
Реклама