Вынос системы чеков из functions в банк напрямик.
This commit is contained in:
@@ -613,69 +613,6 @@ function takeshopitem($item, $table = "shop", $present = '', $onlyonetrip = '',
|
||||
return array("img" => $rec1['img'], "name" => $rec1['name'], "id" => mysql_insert_id());
|
||||
}
|
||||
|
||||
function bank_check($item, $table = "shop", $present = '', $onlyonetrip = '', $fields = 0, $uid = 0, $name = '', $cost = 0)
|
||||
{
|
||||
global $user;
|
||||
if (!$uid) {
|
||||
$uid = $user['id'];
|
||||
}
|
||||
|
||||
$r = mysql_query("SHOW FIELDS FROM `$table`");
|
||||
$r2 = mysql_query("SHOW FIELDS FROM `inventory`");
|
||||
|
||||
while ($rec = mysql_fetch_assoc($r2)) {
|
||||
$flds[$rec['Field']] = 1;
|
||||
}
|
||||
|
||||
$rec1 = mysql_fetch_array(mysql_query("SELECT * FROM `$table` WHERE `id` = '$item' LIMIT 1"));
|
||||
|
||||
if ($rec1['onlyone']) {
|
||||
$i = mysql_fetch_row(mysql_query("SELECT `id` FROM `inventory` WHERE `owner` = '$uid' AND `prototype` = '$item'"));
|
||||
if ($i) {
|
||||
echo "У вас слишком много таких вещей.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($present) {
|
||||
$rec1['present'] = $present;
|
||||
}
|
||||
|
||||
if ($name != '') {
|
||||
$rec1['name'] = $name;
|
||||
}
|
||||
|
||||
if ($cost) {
|
||||
$rec1['cost'] = $cost;
|
||||
}
|
||||
|
||||
$sql = "";
|
||||
while ($rec = mysql_fetch_assoc($r)) {
|
||||
if (!$flds[$rec['Field']]) continue;
|
||||
if ($rec['Field'] == "id" || $rec['Field'] == "prototype" || $rec['Field'] == "dategoden" || $rec['Field'] == "name") continue;
|
||||
$sql .= ", `$rec[Field]` = '" . $rec1[$rec['Field']] . "' ";
|
||||
}
|
||||
|
||||
if ($fields['goden']) {
|
||||
$goden = $fields["goden"];
|
||||
}
|
||||
|
||||
mysql_query("INSERT INTO `inventory` SET `name` = '" . $rec1['name'] . "', `bcost` = $cost, " . ($present ? "`present` = '$present'," : "") . (@$rec1['podzem'] ? "`podzem` = '$rec1[podzem]'," : "") . " `owner` = '$uid', `otdel` = $rec1[razdel] , `prototype` = '$item' " . ($onlyonetrip ? ", `foronetrip` = 1" : "") . ($goden ? ", `dategoden` = '" . ($goden * 60 * 60 * 24 + time()) . "'" : "") . " $sql");
|
||||
}
|
||||
|
||||
function bank_show()
|
||||
{
|
||||
global $user;
|
||||
$pl = mysql_query('SELECT `id`, `name`, `bcost` FROM `inventory` WHERE `owner` = "' . $user['id'] . '" AND `bcost` > 0 ORDER BY `bcost` ASC');
|
||||
if (mysql_num_rows($pl) > 0) {
|
||||
echo '<select name=\'coste\'>';
|
||||
while ($sp = mysql_fetch_array($pl)) {
|
||||
echo '<option value=\'' . $sp['id'] . '\'>' . $sp['name'] . '</option>';
|
||||
}
|
||||
echo '</select> <input class="ctContent" type="submit" value="Обменять" name="saled" />';
|
||||
} else {
|
||||
echo '<b>Нет чеков для обмена</b>';
|
||||
}
|
||||
}
|
||||
|
||||
function select_arenda($u, $type, $redirect = false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user