Файл: pages/account/_pin.php
Строк: 83
<?
$usid = $_SESSION["user_id"];
$usname = $_SESSION["user"];
$db->Query("SELECT * FROM db_users_b WHERE id = '$usid' LIMIT 1");
$user_data = $db->FetchArray();
?>
<div class="block1
"><div class="h-title1
">Активация пмн-кода</div></div>
<div class="block2"><br>
<?
if(isset($_POST['pin'])) {
$pin = htmlspecialchars($_POST['pin']);
$db->Query("SELECT * FROM wmrush_pin WHERE pin = '$pin'");
$kol = $db->NumRows();
$pin = $db->FetchArray();
$id_pin = $pin['id'];
$sum = $pin['summa'];
if($kol != 0) {
if($pin['status'] == 0) {
//$db->Query("UPDATE db_users_b SET money_b = money_b + '$sum' WHERE id = '$usid'");
# Настройки
$db->Query("SELECT * FROM db_config WHERE id = '1' LIMIT 1");
$sonfig_site = $db->FetchArray();
$user_id = $usid;
$db->Query("SELECT user, referer_id FROM db_users_a WHERE id = '$usid' LIMIT 1");
$user_ardata = $db->FetchArray();
$user_name = $user_ardata["user"];
$refid = $user_ardata["referer_id"];
# Зачисляем баланс
$serebro = sprintf("%.4f", floatval($sonfig_site["ser_per_wmr"] * $sum) );
$db->Query("SELECT insert_sum FROM db_users_b WHERE id = '$usid' LIMIT 1");
$ins_sum = $db->FetchRow();
$serebro = intval($ins_sum <= 101) ? ($serebro + ($serebro * 0.20) ) : $serebro;
$add_tree = ( $sum >= 499.99) ? 0 : 0;
$lsb = time();
$to_referer = ($serebro * 0.15);
$db->Query("UPDATE db_users_b SET money_b = money_b + '$serebro', e_t = e_t + '$add_tree', to_referer = to_referer + '$to_referer', last_sbor = '$lsb', insert_sum = insert_sum + '$sum' WHERE id = '$usid'");
# Зачисляем средства рефереру и дерево
$add_tree_referer = ($ins_sum <= 0.01) ? ", a_t = a_t + 1" : "";
$db->Query("UPDATE db_users_b SET money_b = money_b + $to_referer, from_referals = from_referals + '$to_referer' {$add_tree_referer} WHERE id = '$refid'");
# Статистика пополнений
$da = time();
$dd = $da + 60*60*24*15;
$db->Query("INSERT INTO db_insert_money (user, user_id, money, serebro, date_add, date_del)
VALUES ('$user_name','$user_id','$sum','$serebro','$da','$dd')");
# Конкурс
$competition = new competition($db);
$competition->UpdatePoints($user_id, $sum);
#--------
$wmset = new wmset();
$marray = $wmset->GetSet($sum);
$a_t = intval($marray["t_a"]);
$b_t = intval($marray["t_b"]);
$c_t = intval($marray["t_c"]);
$d_t = intval($marray["t_d"]);
$e_t = intval($marray["t_e"]);
$db->Query("UPDATE db_users_b SET a_t = a_t + '$a_t', b_t = b_t + '$b_t', c_t = c_t + '$c_t', d_t = d_t + '$d_t', e_t = e_t + '$e_t',
last_sbor = '$lsb' WHERE id = '$usid'");
# Обновление статистики сайта
$db->Query("UPDATE db_stats SET all_insert = all_insert + '$sum' WHERE id = '1'");
$db->Query("UPDATE wmrush_pin SET status = 1 WHERE id = '$id_pin'");
echo '<center><font color="green">Пинкод активирован!</font></center>';
}else echo '<center><font color="red">Пинкод уже активирован!</font></center>';
}else echo '<center><font color="red">Пин кода не существует</font></center>';
}
?>
<form action="" method="post">
<table width="99%" border="0" align="center">
<tr>
<td><font color="#000;">Введите Пинкод</font>: </td>
<td><input type="text" name="pin" size="15"/></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="swap" value="Активировать Пин" style="height:30px;" class="btn_8"/></td>
</tr>
<tr align="right"><td colspan="2"><font size="1"><a href="http://wmrush.name/" target="_blank"></a></font></tr>
</table>
</form>
</div>
<div class="block3"></div>
<div class="clr"></div>
<div class="clr"></div>