<td valign="top">
<div class="r_block">
<div class="topperss"><span>
<center><h1>Сбор прибыли</h1></center></span></div>
<?PHP
$_OPTIMIZATION["title"] = "Аккаунт - Сбор/Прибыли";
$usid = $_SESSION["user_id"];
$usname = $_SESSION["user"];
$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
$user_data = $db->FetchArray();
$db->Query("SELECT * FROM db_config WHERE id = '1' LIMIT 1");
$sonfig_site = $db->FetchArray();
if(isset($_POST["sbor"])){
if($user_data["last_sbor"] < (time() - 600) ){
$tomat_s = $func->SumCalc($sonfig_site["a_in_h"], $user_data["a_t"], $user_data["last_sbor"]);
$straw_s = $func->SumCalc($sonfig_site["b_in_h"], $user_data["b_t"], $user_data["last_sbor"]);
$pump_s = $func->SumCalc($sonfig_site["c_in_h"], $user_data["c_t"], $user_data["last_sbor"]);
$peas_s = $func->SumCalc($sonfig_site["d_in_h"], $user_data["d_t"], $user_data["last_sbor"]);
$pean_s = $func->SumCalc($sonfig_site["e_in_h"], $user_data["e_t"], $user_data["last_sbor"]);
$snow_s = $func->SumCalc($sonfig_site["f_in_h"], $user_data["f_t"], $user_data["last_sbor"]);
$db->Query("UPDATE db_users_b SET
a_b = a_b + '$tomat_s',
b_b = b_b + '$straw_s',
c_b = c_b + '$pump_s',
d_b = d_b + '$peas_s',
e_b = e_b + '$pean_s',
f_b = f_b + '$snow_s',
all_time_a = all_time_a + '$tomat_s',
all_time_b = all_time_b + '$straw_s',
all_time_c = all_time_c + '$pump_s',
all_time_d = all_time_d + '$peas_s',
all_time_e = all_time_e + '$pean_s',
all_time_f = all_time_f + '$snow_s',
last_sbor = '".time()."'
WHERE id = '$usid' LIMIT 1");
echo "<center><font color = 'green'><b>Вы успешно собрали прибыль!</b></font></center><BR />";
$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
$user_data = $db->FetchArray();
}else echo "<center><font color = 'red'><b>Прибыль можно собирать не чаще 1-го раза за 10 минут!</b></font></center><BR />";
}
?>
<h3>
Вся Ваша доля с добычи, собирайте её и сбывайте. Вы можете делать это раз в 10 мин. Прибыль постоянно накапливается в хранилище, Вы можете собирать её влюбое подходящее для Вас время, как Вам удобнее.<br />
Распределение при продаже: <font style="color:#71E67B;"><?=100-$sonfig_site["percent_sell"]; ?>%</font> на счет для покупок и <font style="color:#71E67B;"><?=$sonfig_site["percent_sell"]; ?>%</font> на вывод.</font><br />
</h3>
<div class="clr"></div>
<style>
#good {
border-color: #489E12;
}
#error {
border-color: #EC5E0B;
}
.alert {
color: #650202;
margin: 5px 0;
padding: 8px 35px 8px 14px;
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.5);
background-color: #F5CE9D;
border: 2px solid #3Aa73D;
border-radius: 2px;
}
</style>
<style>
.block {
background: #5F3D00;
border-radius: 0.2em;
font-size: 1.125rem;
position: relative;
width: 100%;
margin: 20px 0px 0px 220px;
border: 1px solid #a57b31;
margin-left: 3px;
}
.block_name {
background: linear-gradient(to top, #5F3D00 0%, #132712 100%) repeat scroll 0% 0% transparent;
background: -webkit-linear-gradient(top, #5F3D00 0%, #132712 100%);
background: -moz-linear-gradient(top, #5F3D00 0%, #132712 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, #5F3D00), color-stop(100%, #132712));
background: -o-linear-gradient(top, #5F3D00 0%, #132712 100%);
background: -ms-linear-gradient(top, #5F3D00 0%, #132712 100%);
border-radius: 0.2em 0 0 0.2em;
font-size: 1.125rem;
position: relative;
padding: 5px 15px;
}
.block2 {
color: #F78C07;
border: 2px solid #dda45d;
background: #F1DDBC;
border-radius: 4px;
font-size: 1.125rem;
position: relative;
width: 98%;
margin: 5px;
border: 1px solid #DDaE9C;
}
</style>
<?PHP
# Продажа
if(isset($_POST["sell"])){
$all_items = $user_data["a_b"] + $user_data["b_b"] + $user_data["c_b"] + $user_data["d_b"] + $user_data["e_b"] + $user_data["f_b"];
if($all_items > 0){
$money_add = $func->SellItems($all_items, $sonfig_site["items_per_coin"]);
$tomat_b = $user_data["a_b"];
$straw_b = $user_data["b_b"];
$pump_b = $user_data["c_b"];
$pean_b = $user_data["d_b"];
$peas_b = $user_data["e_b"];
$snow_b = $user_data["f_b"];
$money_b = ( (100 - $sonfig_site["percent_sell"]) / 100) * $money_add;
$money_p = ( ($sonfig_site["percent_sell"]) / 100) * $money_add;
# Обновляем юзверя
$db->Query("UPDATE db_users_b SET money_b = money_b + '$money_b', money_p = money_p + '$money_p', a_b = 0, b_b = 0, c_b = 0, d_b = 0, e_b = 0, f_b = 0
WHERE id = '$usid'");
$da = time();
$dd = $da + 60*60*24*15;
# Вставляем запись в статистику
$db->Query("INSERT INTO db_sell_items (user, user_id, a_s, b_s, c_s, d_s, e_s, f_s, amount, all_sell, date_add, date_del) VALUES
('$usname','$usid','$tomat_b','$straw_b','$pump_b','$pean_b','$peas_b','$snow_b','$money_add','$all_items','$da','$dd')");
echo "<center><font color = 'green'><b>Вы сняли {$all_items} на сумму {$money_add} RUB!</b></font></center><BR />";
$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
$user_data = $db->FetchArray();
}else echo "<center><font color = 'white'><b>Вам нечего снимать :(</b></font></center><BR />";
}
?>
<form action="" method="post">
<div class="block">
<center><div class="block_name"><font style="color:#F7ECC4;">Kоличество Ваших викингов: <?php $all_items = $user_data["a_t"] + $user_data["b_t"] + $user_data["c_t"] + $user_data["d_t"] + $user_data["e_t"] + $user_data["f_t"]; echo $all_items ?> </font> </div></center>
<div class="l_block">
<table width="100%" align="center"><tbody><tr>
<td width="150px"><img style="width: 87px; height: 130px;padding: 5px; border: 3px solid #e1c467;" src="/img/Thorunn.png"></td>
<td width="120px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$user_data["a_t"]; ?></b><br>Thorunn</center> </td>
<td width="140px"><img style="width: 200px; height: 170px;margin-top: 10px;margin-left: 28px;" src="/img/tovar.png"></td>
<td width="250px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$func->SumCalc($sonfig_site["a_in_h"], $user_data["a_t"], $user_data["last_sbor"]);?></b><br>RUB</center> </td>
</tr></tbody></table></div>
<br />
<div class="l_block">
<table width="100%" align="center"><tbody><tr>
<td width="150px"><img style="width: 87px; height: 130px;padding: 5px; border: 3px solid #e1c467;" src="/img/green.png"></td>
<td width="120px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$user_data["b_t"]; ?></b><br>Floki</center> </td>
<td width="140px"><img style="width: 200px; height: 170px;margin-top: 10px;margin-left: 28px;" src="/img/tovar.png"></td>
<td width="250px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$func->SumCalc($sonfig_site["b_in_h"], $user_data["b_t"], $user_data["last_sbor"]);?></b><br>RUB</center> </td>
</tr></tbody></table></div>
<br />
<div class="l_block">
<table width="100%" align="center"><tbody><tr>
<td width="150px"><img style="width: 87px; height: 130px;padding: 5px; border: 3px solid #e1c467;" src="/img/blue.png"></td>
<td width="120px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$user_data["c_t"]; ?></b><br>Bjorn</center> </td>
<td width="140px"><img style="width: 200px; height: 170px;margin-top: 10px;margin-left: 28px;" src="/img/tovar.png"></td>
<td width="250px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$func->SumCalc($sonfig_site["c_in_h"], $user_data["c_t"], $user_data["last_sbor"]);?></b><br>RUB</center> </td>
</tr></tbody></table></div>
<br />
<div class="l_block">
<table width="100%" align="center"><tbody><tr>
<td width="150px"><img style="width: 87px; height: 130px;padding: 5px; border: 3px solid #e1c467;" src="/img/brown.png"></td>
<td width="120px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$user_data["d_t"]; ?></b><br>Rollo</center> </td>
<td width="140px"><img style="width: 200px; height: 170px;margin-top: 10px;margin-left: 28px;" src="/img/tovar.png"></td>
<td width="250px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$func->SumCalc($sonfig_site["d_in_h"], $user_data["d_t"], $user_data["last_sbor"]);?></b><br>RUB</center> </td>
</tr></tbody></table></div>
<br />
<div class="l_block">
<table width="100%" align="center"><tbody><tr>
<td width="150px"><img style="width: 87px; height: 130px;padding: 5px; border: 3px solid #e1c467;" src="/img/yellow.png"></td>
<td width="120px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$user_data["e_t"]; ?></b><br>Lagertha</center> </td>
<td width="140px"><img style="width: 200px; height: 170px;margin-top: 10px;margin-left: 28px;" src="/img/tovar.png"></td>
<td width="250px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$func->SumCalc($sonfig_site["e_in_h"], $user_data["e_t"], $user_data["last_sbor"]);?></b><br>RUB</center> </td>
</tr></tbody></table></div>
<br />
<div class="l_block">
<table width="100%" align="center"><tbody><tr>
<td width="150px"><img style="width: 87px; height: 130px;padding: 5px; border: 3px solid #e1c467;" src="/img/red.png"></td>
<td width="120px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$user_data["f_t"]; ?></b><br>Ragnar</center> </td>
<td width="140px"><img style="width: 200px; height: 170px;margin-top: 10px;margin-left: 28px;" src="/img/tovar.png"></td>
<td width="250px" style="color:#ffce80;"> <center><b style="font-size: 24px;"><?=$func->SumCalc($sonfig_site["f_in_h"], $user_data["f_t"], $user_data["last_sbor"]);?></b><br>RUB</center> </td>
</tr></tbody></table></div>
<center><div class="block_name"><font style="color:#F7ECC4;">Cобрано: <?php $all_items = $user_data["a_b"] + $user_data["b_b"] + $user_data["c_b"] + $user_data["d_b"] + $user_data["e_b"] + $user_data["f_b"]; echo $all_items ?> RUB</font></div></center>
</div>
<center>
<br />
<form action="" method="post">
<input type="submit" name="sbor" value="Собрать все" class="bat">
<input type="submit" name="sell" value="Вывести на счет <?php $all_items = $user_data["a_b"] + $user_data["b_b"] + $user_data["c_b"] + $user_data["d_b"] + $user_data["e_b"] + $user_data["f_b"]; echo $all_items/100 ?> RUB" style="width: 50%;"class="bat" >
</form>
<br>
</div>