<?php if (isset($_GET['type'])) { $type = (int) $_GET['type']; if ($type == 1 and $shop['oruj'] == 1 and $shop['oruj_store_current'] > 0 or $type == 5 and $shop['dosp'] == 1 and $shop['dosp_store_current'] > 0 or $type == 4 and $shop['shit'] == 1 and $shop['shit_store_current'] > 0 or $type == 2 and $shop['ring'] == 1 and $shop['ring_store_current'] > 0 or $type == 8 and $shop['pojas'] == 1 and $shop['pojas_store_current'] > 0 or $type == 6 and $shop['shlem'] == 1 and $shop['shlem_store_current'] > 0 or $type == 7 and $shop['mag'] == 1 and $shop['mag_store_current'] > 0 or $type == 3 and $shop['artef'] == 1 and $shop['artef_store_current'] > 0 or $type == 9 and $shop['amulet'] == 1 and $shop['amulet_store_current'] > 0 or $type == 10 and $shop['perch'] == 1 and $shop['perch_store_current'] > 0 or $type == 11 and $shop['boots'] == 1 and $shop['boots_store_current'] > 0 or $type == 13 and $shop['eliksir'] == 1 and $shop['eliksir_store_current'] > 0 or $type == 14 and $shop['shtan'] == 1 and $shop['shtan_store_current'] > 0 or $type == 15 and $shop['naruchi'] == 1 and $shop['naruchi_store_current'] > 0 or $type == 16 and $shop['ukrash'] == 1 and $shop['ukrash_store_current'] > 0 or $type == 12 and $shop['svitki'] == 1 and $shop['svitki_store_current'] > 0 or $type == 17 and $shop['magic_books'] == 1 and $shop['magic_books_store_current'] > 0 or $type == 18 and $shop['luk'] == 1 and $shop['luk_store_current'] > 0 or $type == 20 and $shop['schema'] == 1 and $shop['schema_store_current'] > 0 or $type == 24 and $shop['instrument'] == 1 and $shop['instrument_store_current'] > 0 or $type == 97 and $shop['others'] == 1 and $shop['others_store_current'] > 0) { if (isset($_POST['buy'])) { $buy = (int) $_GET['buy']; $kol = (int) $_POST['kol']; $result = myquery("SELECT gif.name FROM game_items_factsheet gif JOIN game_shop_items gsi ON gif.id = gsi.items_id WHERE gif.id='" . $buy . "' and gsi.shop_id='" . $shop['id'] . "' "); if (mysql_num_rows($result) == 1 and $kol > 0) { list($name) = mysql_fetch_array($result); $i = 0; $gp = 0; while ($kol > 0) { $Item = new Item(); $ar = $Item->buy($buy); if ($ar[0] > 0) { $char['GP'] -= $ar[0]; $gp += $ar[0]; $char['CW'] += $ar[1]; $kol--; $i++; } else { break; } } if ($i > 0) { $result = myquery("UPDATE game_users SET gp=" . $char['GP'] . ", CW=" . $char['CW'] . " WHERE user_id=" . $user_id . ""); setGP($user_id, -$gp, 9); $pismo = 'Вы купили предмет ' . $name . ' - ' . $i . ' шт. за ' . $gp . ' ' . pluralform($gp, 'монету', 'монеты', 'монет') . '!'; echo '<b><center><font color=ff0000><br>' . $pismo . '</font></center></b>';