450 lines
25 KiB
PHP
450 lines
25 KiB
PHP
<?php
|
|
header('Expires: Mon, 26 Jul 1970 05:00:00 GMT');
|
|
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
|
|
header('Cache-Control: no-store, no-cache, must-revalidate');
|
|
header('Cache-Control: post-check=0, pre-check=0', false);
|
|
header('Pragma: no-cache');
|
|
header('Content-Type: text/html; charset=windows-1251');
|
|
if ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
|
|
define('GAME', true);
|
|
include('_incl_data/__config.php');
|
|
include('_incl_data/class/__db_connect.php');
|
|
$u = User::start();
|
|
|
|
if ($u->info['repass'] > 0) {
|
|
die();
|
|
}
|
|
|
|
if (isset($u->tfer['id']) && $u->info['align'] != 2) {
|
|
if ($u->tfer['finish1'] == 0 && $u->tfer['finish2'] == 0) {
|
|
$js = '';
|
|
$mn = 0;
|
|
if (isset($_POST['cancel2'])) {
|
|
$u->tfer['r0'] = time();
|
|
$u->tfer['good1'] = 0;
|
|
$u->tfer['good2'] = 0;
|
|
$_POST['id'] = 'reflesh';
|
|
mysql_query(
|
|
'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '",`r1` = "0",`r2` = "0",`good1` = "0",`good2` = "0" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
} elseif (isset($_POST['start2'])) {
|
|
//ñîõðàíÿåì îáìåí
|
|
if ($u->tfer['good1'] > 0 && $u->tfer['good2'] > 0) {
|
|
//çàâåðøàåì îáìåí
|
|
$u->tfer['cancel1'] = time();
|
|
$u->tfer['cancel2'] = time();
|
|
$u->tfer['finish1'] = time();
|
|
$u->tfer['finish2'] = time();
|
|
//ìåíÿåì âåùè + ïåðåäàåì ÊÐ è çàâåðøàåì ïåðåäà÷è, ïåðåõîä íà ëîã ïåðåäà÷
|
|
$upd2 = mysql_query(
|
|
'UPDATE `transfers` SET `cancel1` = "' . $u->tfer['cancel1'] . '",`cancel2` = "' . $u->tfer['cancel2'] . '",`finish1` = "' . $u->tfer['finish1'] . '",`finish2` = "' . $u->tfer['finish2'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
//Îáìåíèâàåì äåíüãè
|
|
$mn1 = 0;
|
|
$mn2 = 0;
|
|
$inf = [];
|
|
$inf[$u->tfer['uid1']] = mysql_fetch_array(
|
|
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $u->tfer['uid1'] . '" LIMIT 1')
|
|
);
|
|
$inf[$u->tfer['uid2']] = mysql_fetch_array(
|
|
mysql_query('SELECT * FROM `users` WHERE `id` = "' . $u->tfer['uid2'] . '" LIMIT 1')
|
|
);
|
|
if ($inf[$u->tfer['uid1']]['money'] < $u->tfer['money1']) {
|
|
$u->tfer['money1'] = $inf[$u->tfer['uid1']]['money'];
|
|
}
|
|
if ($inf[$u->tfer['uid2']]['money'] < $u->tfer['money2']) {
|
|
$u->tfer['money2'] = $inf[$u->tfer['uid2']]['money'];
|
|
}
|
|
|
|
$mn1 = $u->tfer['money1'];
|
|
$mn2 = $u->tfer['money2'];
|
|
if ($mn1 < 0) {
|
|
$mn1 = 0;
|
|
}
|
|
if ($mn2 < 0) {
|
|
$mn2 = 0;
|
|
}
|
|
|
|
if ($mn1 > 0) {
|
|
//èãðîê 1 ïåðåäàåò äåíüãè èãðîêó 2
|
|
$upd = mysql_query(
|
|
'UPDATE `users` SET `money` = `money` - "' . $mn1 . '" WHERE `id` = "' . $inf[$u->tfer['uid1']]['id'] . '" LIMIT 1'
|
|
);
|
|
if ($upd) {
|
|
$upd = mysql_query(
|
|
'UPDATE `users` SET `money` = `money` + "' . $mn1 . '" WHERE `id` = "' . $inf[$u->tfer['uid2']]['id'] . '" LIMIT 1'
|
|
);
|
|
if ($upd) {
|
|
$u->addDelo(
|
|
2, $inf[$u->tfer['uid1']]['id'],
|
|
'"<font color="green">System.transfer.MONEY</font>": Ïåðåäàíî ' . $mn1 . ' êð. ïåðñîíàæó "' . $inf[$u->tfer['uid2']]['login'] . '" (' . $inf[$u->tfer['uid2']]['id'] . ').',
|
|
time(), $u->info['city'], 'System.transfer', 0, 0
|
|
);
|
|
$u->addDelo(
|
|
2, $inf[$u->tfer['uid2']]['id'],
|
|
'"<font color="green">System.transfer.MONEY</font>": Ïîëó÷åíî ' . $mn1 . ' êð. îò ïåðñîíàæà "' . $inf[$u->tfer['uid1']]['login'] . '" (' . $inf[$u->tfer['uid1']]['id'] . ').',
|
|
time(), $u->info['city'], 'System.transfer', 0, 0
|
|
);
|
|
} else {
|
|
$u->addDelo(
|
|
2, $inf[$u->tfer['uid1']]['id'],
|
|
'"<font color="green">System.transfer.MONEY</font>": Ïåðåäàíî ' . $mn1 . ' êð. ïåðñîíàæó "' . $inf[$u->tfer['uid2']]['login'] . '" (' . $inf[$u->tfer['uid2']]['id'] . '), îøèáêà âî âðåìÿ ïåðåäà÷è.',
|
|
time(), $u->info['city'], 'System.transfer', 0, 0
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($mn2 > 0) {
|
|
//èãðîê 2 ïåðåäàåò äåíüãè èãðîêó 1
|
|
$upd = mysql_query(
|
|
'UPDATE `users` SET `money` = `money` - "' . $mn2 . '" WHERE `id` = "' . $inf[$u->tfer['uid2']]['id'] . '" LIMIT 1'
|
|
);
|
|
if ($upd) {
|
|
$upd = mysql_query(
|
|
'UPDATE `users` SET `money` = `money` + "' . $mn2 . '" WHERE `id` = "' . $inf[$u->tfer['uid1']]['id'] . '" LIMIT 1'
|
|
);
|
|
if ($upd) {
|
|
$u->addDelo(
|
|
2, $inf[$u->tfer['uid2']]['id'],
|
|
'"<font color="green">System.transfer.MONEY</font>": Ïåðåäàíî ' . $mn2 . ' êð. ïåðñîíàæó "' . $inf[$u->tfer['uid1']]['login'] . '" (' . $inf[$u->tfer['uid1']]['id'] . ').',
|
|
time(), $u->info['city'], 'System.transfer', 0, 0
|
|
);
|
|
$u->addDelo(
|
|
2, $inf[$u->tfer['uid1']]['id'],
|
|
'"<font color="green">System.transfer.MONEY</font>": Ïîëó÷åíî ' . $mn2 . ' êð. îò ïåðñîíàæà "' . $inf[$u->tfer['uid2']]['login'] . '" (' . $inf[$u->tfer['uid2']]['id'] . ').',
|
|
time(), $u->info['city'], 'System.transfer', 0, 0
|
|
);
|
|
} else {
|
|
$u->addDelo(
|
|
2, $inf[$u->tfer['uid2']]['id'],
|
|
'"<font color="green">System.transfer.MONEY</font>": Ïåðåäàíî ' . $mn2 . ' êð. ïåðñîíàæó "' . $inf[$u->tfer['uid1']]['login'] . '" (' . $inf[$u->tfer['uid1']]['id'] . '), îøèáêà âî âðåìÿ ïåðåäà÷è.',
|
|
time(), $u->info['city'], 'System.transfer', 0, 0
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Îáìåíèâàåì ïðåäìåòû
|
|
$sp = mysql_query(
|
|
'SELECT `u`.*,`m`.`price1`,`m`.`price2`,`m`.`name` FROM `items_users` AS `u` LEFT JOIN `items_main` AS `m` ON `m`.`id` = `u`.`item_id` WHERE (`u`.`uid`="' . $u->tfer['uid1'] . '" OR `u`.`uid`="' . $u->tfer['uid2'] . '") AND `u`.`delete`="0" AND `u`.`inOdet`="0" AND `u`.`inShop`="0" AND `u`.`inTransfer` > "0" AND `u`.`data` NOT LIKE "%|zazuby=%"'
|
|
);
|
|
$nalog = 0;
|
|
$fu = 0;
|
|
$x = 0;
|
|
$uus = [];
|
|
while ($pl = mysql_fetch_array($sp)) {
|
|
$x = $u->itemsX($pl['id'], $pl['uid']);
|
|
$fu = $pl['uid'];
|
|
if ($pl['uid'] == $u->tfer['uid1']) {
|
|
$pl['uid'] = $u->tfer['uid2'];
|
|
} elseif ($pl['uid'] == $u->tfer['uid2']) {
|
|
$pl['uid'] = $u->tfer['uid1'];
|
|
}
|
|
$us = $inf[$pl['uid']];
|
|
$uus = $inf[$fu];
|
|
if ($pl['inTransfer'] == 1) {
|
|
//ïîäàðîê
|
|
$pl['gift'] = $uus['login'];
|
|
} else {
|
|
//íàëîã
|
|
$nalog += 1;
|
|
}
|
|
$upd = mysql_query(
|
|
'UPDATE `items_users` SET `uid` = "' . $pl['uid'] . '",`gift` = "' . $pl['gift'] . '" WHERE `id` = "' . $pl['id'] . '" AND `inShop` = "0" AND `delete` < "1234567891" AND `inOdet` = "0" AND `data` NOT LIKE "%|zazuby=%"'
|
|
);
|
|
if ($upd) {
|
|
if ($pl['2price'] == 0 && $pl['1price'] == 0) {
|
|
$pl['2price'] = $pl['price2'];
|
|
}
|
|
if ($pl['1price'] == 0 && $pl['2price'] == 0) {
|
|
$pl['1price'] = $pl['price1'];
|
|
}
|
|
$po = $u->lookStats($pl['data']);
|
|
$i_s = '';
|
|
if (isset($po['frompisher']) && $po['frompisher'] > 0) {
|
|
$i_s = '[Ïðåäìåò èç ïîäçåìåëüÿ]';
|
|
}
|
|
//çàíîñèì â ëè÷íûå äåëà
|
|
$u->addDelo(
|
|
2, $fu,
|
|
'"<font color="green">System.transfer</font>": Ïðåäìåò "<b>' . $pl['name'] . '</b> (ñòîèìîñòü: ' . $pl['1price'] . ' êð. , ' . $pl['2price'] . ' åêð.) (x' . $x . ')" [itm:' . $pl['id'] . '] ' . $i_s . ' áûë ïåðåäàí ïåðñîíàæó "' . $us['login'] . '"(' . $pl['uid'] . '), Òèï ïåðåäà÷è: ' . $pl['inTransfer'] . '.',
|
|
time(), $u->info['city'], 'System.transfer', 0, 0
|
|
);
|
|
$u->addDelo(
|
|
2, $pl['uid'],
|
|
'"<font color="green">System.transfer</font>": Ïåðñîíàæ "' . $uus['login'] . '"(' . $uus['id'] . ') ïåðåäàë ïðåäìåò "<b>' . $pl['name'] . '</b> ' . $i_s . ' (ñòîèìîñòü: ' . $pl['1price'] . ' êð. , ' . $pl['2price'] . ' åêð.) (x' . $x . ')" [itm:' . $pl['id'] . '], Òèï ïåðåäà÷è: ' . $pl['inTransfer'] . '.',
|
|
time(), $u->info['city'], 'System.transfer', 0, 0
|
|
);
|
|
} else {
|
|
echo 'Îøèáêà ïåðåäà÷è ïðåäìåòà';
|
|
}
|
|
}
|
|
$upd1 = mysql_query(
|
|
'UPDATE `items_users` SET `inTransfer` = "0" WHERE (`uid`="' . $u->tfer['uid1'] . '" OR `uid`="' . $u->tfer['uid2'] . '") AND `delete` < "1234567891" AND `inOdet`="0" AND `inShop`="0" AND `inTransfer` > "0" AND `data` NOT LIKE "%|zazuby=%"'
|
|
);
|
|
if ($upd1 && $upd2) {
|
|
$js .= 'location = location;';
|
|
}
|
|
unset($upd1, $upd2, $fu, $nalog, $x, $us, $uus, $inf);
|
|
} else {
|
|
//ïîäòâåðæäåíèå îáìåíà
|
|
$u->tfer['r0'] = time();
|
|
if ($u->tfer['uid1'] == $u->info['id']) {
|
|
$u->tfer['good1'] = time();
|
|
$mn = 1;
|
|
mysql_query(
|
|
'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '",`r1` = "0",`r2` = "0",`good1` = "' . $u->tfer['good1'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
} else {
|
|
$u->tfer['good2'] = time();
|
|
$mn = 1;
|
|
mysql_query(
|
|
'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '",`r1` = "0",`r2` = "0",`good2` = "' . $u->tfer['good2'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
}
|
|
$_POST['id'] = 'reflesh';
|
|
}
|
|
} elseif ($_POST['id'] == 'sale' && isset($_POST['cancelid']) && $u->tfer['good1'] == 0 && $u->tfer['good2'] == 0) {
|
|
$upd = mysql_query(
|
|
'UPDATE `items_users` SET `inTransfer` = "0" WHERE `id` = "' . mysql_real_escape_string(
|
|
$_POST['cancelid']
|
|
) . '" AND `uid`="' . $u->info['id'] . '" AND `delete`="0" AND `inOdet`="0" AND `inShop`="0" AND `inTransfer` > "0" AND `data` NOT LIKE "%|zazuby=%" LIMIT 1'
|
|
);
|
|
if ($upd) {
|
|
$u->tfer['r0'] = time();
|
|
mysql_query(
|
|
'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
$_POST['id'] = 'reflesh';
|
|
}
|
|
} elseif ($_POST['id'] == 'sale' && isset($_POST['itemid']) && $u->tfer['good1'] == 0 && $u->tfer['good2'] == 0) {
|
|
$g = 1;
|
|
$itm = mysql_fetch_array(
|
|
mysql_query(
|
|
'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`id` = "' . mysql_real_escape_string(
|
|
$_POST['itemid']
|
|
) . '" AND `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` = "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" LIMIT 1'
|
|
)
|
|
);
|
|
if (isset($itm['id'])) {
|
|
$po = $u->lookStats($itm['data']);
|
|
if (isset($po['sudba']) && $po['sudba'] != '0') {
|
|
$g = 0;
|
|
}
|
|
if ($itm['inTransfer'] > 0) {
|
|
$g = 0;
|
|
}
|
|
} else {
|
|
$g = 0;
|
|
}
|
|
if ($g == 1) {
|
|
if ($_POST['saletype'] == 2) {
|
|
$g = 2;
|
|
} else {
|
|
$g = 1;
|
|
}
|
|
mysql_query(
|
|
'UPDATE `items_users` SET `inTransfer` = "' . ((int)$g) . '",`inGroup` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
|
|
);
|
|
$u->tfer['r0'] = time();
|
|
mysql_query(
|
|
'UPDATE `transfers` SET `r0` = "' . $u->tfer['r0'] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
$_POST['id'] = 'reflesh';
|
|
}
|
|
}
|
|
|
|
if ($_POST['id'] == 'reflesh') {
|
|
//îáíîâëåíèå èíâåíòàðÿ
|
|
$i = 1;
|
|
while ($i <= 6) {
|
|
$itmAll = '';
|
|
$itmAllSee = '';
|
|
$itmAll = $u->genInv(
|
|
5,
|
|
'`iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`data` NOT LIKE "%toclan=' . $u->info['clan'] . '#%" AND `iu`.`delete` = 0 AND `iu`.`inOdet` =0 AND `iu`.`inShop` = 0 AND `im`.`inRazdel` = "' . $i . '" AND `iu`.`inTransfer` = 0 ORDER BY `lastUPD` DESC'
|
|
);
|
|
|
|
if ($itmAll[0] == 0) {
|
|
$itmAllSee = '<tr><td align="center" bgcolor="#e2e0e0">ÏÓÑÒÎ</td></tr>';
|
|
} else {
|
|
$itmAllSee = $itmAll[2];
|
|
}
|
|
$itmAllSee = str_replace("'", "", $itmAllSee);
|
|
$itmAllSee = str_replace('"', '"', $itmAllSee);
|
|
$itmAllSee = str_replace("\n", '', $itmAllSee);
|
|
$itmAllSee = str_replace("\r", '', $itmAllSee);
|
|
$js .= '$(\'#inv' . $i . '\').html(\'' . $itmAllSee . '\');';
|
|
$i++;
|
|
}
|
|
unset($itmAll, $itmAllSee);
|
|
}
|
|
if ($_POST['id'] == 'minireflesh' || $_POST['id'] == 'reflesh') {
|
|
//Ìèíè îáíîâëåíèå
|
|
if (($u->tfer['start2'] > 0 && $u->info['id'] == $u->tfer['uid1']) || ($u->tfer['start1'] > 0 && $u->info['id'] == $u->tfer['uid2'])) {
|
|
$js .= 's2g();';
|
|
}
|
|
//Îáíîâëÿåì ïðåäìåòû
|
|
$f = 1;
|
|
if ($u->info['id'] == $u->tfer['uid2']) {
|
|
$f = 2;
|
|
}
|
|
if ($u->tfer['r' . $f] != $u->tfer['r0']) {
|
|
function itmInfotf($pl, $cl)
|
|
{
|
|
global $u, $c, $code;
|
|
$x = $u->itemsX($pl['id'], $pl['uid']);
|
|
if ($x > 1) {
|
|
$x = ' (x' . $x . ')';
|
|
} else {
|
|
$x = '';
|
|
}
|
|
$r = '';
|
|
if ($pl['uid'] == $u->info['id']) {
|
|
$r .= '<img width="13" height="13" onClick="cancelitm(' . $pl['id'] . ');" class="clr" src="https://img.new-combats.com/i/clear.gif" />';
|
|
}
|
|
$r .= '<a href="items_info.php?id=' . $pl['item_id'] . '&rnd=' . $code . '" target="_blank">' . $pl['name'] . '' . $x . '</a><br>';
|
|
if ($pl['inTransfer'] == 1) {
|
|
$r .= '<img width="16" height="18" title="Ýòîò ïðåäìåò áóäåò ïîäàðåí" src="https://img.new-combats.com/i/podarok.gif" />';
|
|
} else {
|
|
$r .= '<small style="font-size:10px">(íàëîã: 1êð.)</small>';
|
|
}
|
|
$r = '<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td width="50" align="center"><img src="https://img.new-combats.com/i/items/' . $pl['img'] . '" class="tfii"/></td><td valign="top" class="tfid">' . $r . '</td></tr></table>';
|
|
$r = '<div class="tfitm' . $cl . '">' . $r . '</div>';
|
|
unset($x);
|
|
return $r;
|
|
}
|
|
|
|
//Òî÷íî îáíîâëÿåì :)
|
|
$itm = [1 => '', 2 => ''];
|
|
//ïðåäìåòû ïåðñîíàæà 1
|
|
$sp = mysql_query(
|
|
'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u->tfer['uid1'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` > "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" ORDER BY `iu`.`lastUPD` DESC'
|
|
);
|
|
$cl = 2;
|
|
while ($pl = mysql_fetch_array($sp)) {
|
|
if ($cl == 2) {
|
|
$cl = 1;
|
|
} else {
|
|
$cl = 2;
|
|
}
|
|
$itm[1] .= itmInfotf($pl, $cl);
|
|
}
|
|
//ïðåäìåòû ïåðñîíàæà 2
|
|
$sp = mysql_query(
|
|
'SELECT `im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid`="' . $u->tfer['uid2'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`inTransfer` > "0" AND `iu`.`data` NOT LIKE "%|zazuby=%" ORDER BY `iu`.`lastUPD` DESC'
|
|
);
|
|
$cl = 2;
|
|
while ($pl = mysql_fetch_array($sp)) {
|
|
if ($cl == 2) {
|
|
$cl = 1;
|
|
} else {
|
|
$cl = 2;
|
|
}
|
|
$itm[2] .= itmInfotf($pl, $cl);
|
|
}
|
|
unset($cl);
|
|
if ($itm[1] == '') {
|
|
$itm[1] = ' ';
|
|
}
|
|
if ($itm[2] == '') {
|
|
$itm[2] = ' ';
|
|
}
|
|
|
|
if ($u->info['id'] == $u->tfer['uid1']) {
|
|
$js .= '$("#s2g3").html(\'' . $itm[1] . '\');$("#s2g2").html(\'' . $itm[2] . '\');';
|
|
} else {
|
|
$js .= '$("#s2g3").html(\'' . $itm[2] . '\');$("#s2g2").html(\'' . $itm[1] . '\');';
|
|
}
|
|
$u->tfer['r' . $f] = $u->tfer['r0'];
|
|
mysql_query(
|
|
'UPDATE `transfers` SET `r' . $f . '` = "' . $u->tfer['r' . $f] . '" WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
}
|
|
if (($u->tfer['good1'] > 0 && $u->info['id'] == $u->tfer['uid1']) || ($u->tfer['good2'] > 0 && $u->info['id'] == $u->tfer['uid2'])) {
|
|
$js .= '$(\'#btn1\').html(\'Îáìåíÿòü\');';
|
|
if ($u->tfer['good1'] > 0 && $u->tfer['good2'] > 0) {
|
|
$js .= '$(\'#btn1\').attr(\'disabled\',\'\');';
|
|
} else {
|
|
$js .= '$(\'#btn1\').attr(\'disabled\',\'disabled\');';
|
|
}
|
|
} else {
|
|
$js .= '$(\'#btn1\').html(\'Ãîòîâ ê îáìåíó\');$(\'#btn1\').attr(\'disabled\',\'\');';
|
|
}
|
|
|
|
//Îáíîâëÿåì äåíüãè â êàññå :)
|
|
if ($u->tfer['uid1'] == $u->info['id']) {
|
|
if ($u->tfer['good1'] > 0) {
|
|
$js .= '$(\'#gd2\').css(\'display\',\'\');';
|
|
} else {
|
|
$js .= '$(\'#gd2\').css(\'display\',\'none\');';
|
|
} //âû
|
|
if ($u->tfer['good2'] > 0) {
|
|
$js .= '$(\'#gd1\').css(\'display\',\'\');';
|
|
} else {
|
|
$js .= '$(\'#gd1\').css(\'display\',\'none\');';
|
|
}
|
|
|
|
if (($u->tfer['good1'] == 0 && $u->tfer['good2'] == 0) || $mn == 1) {
|
|
if ($u->tfer['money1'] != round($_POST['money'], 2)) {
|
|
$u->tfer['money1'] = round($_POST['money'], 2);
|
|
if ($u->tfer['money1'] > $u->info['money']) {
|
|
$u->tfer['money1'] = $u->info['money'];
|
|
}
|
|
if ($u->tfer['money1'] < 0) {
|
|
$u->tfer['money1'] = 0;
|
|
}
|
|
mysql_query(
|
|
'UPDATE `transfers` SET `money1` = "' . mysql_real_escape_string(
|
|
$u->tfer['money1']
|
|
) . '",`good1` = 0,`good2` = 0 WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
}
|
|
}
|
|
} else {
|
|
if ($u->tfer['good2'] > 0) {
|
|
$js .= '$(\'#gd2\').css(\'display\',\'\');';
|
|
} else {
|
|
$js .= '$(\'#gd2\').css(\'display\',\'none\');';
|
|
} //âû
|
|
if ($u->tfer['good1'] > 0) {
|
|
$js .= '$(\'#gd1\').css(\'display\',\'\');';
|
|
} else {
|
|
$js .= '$(\'#gd1\').css(\'display\',\'none\');';
|
|
}
|
|
|
|
if (($u->tfer['good1'] == 0 && $u->tfer['good2'] == 0) || $mn == 1) {
|
|
if ($u->tfer['money2'] != round($_POST['money'], 2)) {
|
|
$u->tfer['money2'] = round($_POST['money'], 2);
|
|
if ($u->tfer['money2'] > $u->info['money']) {
|
|
$u->tfer['money2'] = $u->info['money'];
|
|
}
|
|
if ($u->tfer['money1'] < 0) {
|
|
$u->tfer['money1'] = 0;
|
|
}
|
|
mysql_query(
|
|
'UPDATE `transfers` SET `money2` = "' . mysql_real_escape_string(
|
|
$u->tfer['money2']
|
|
) . '",`good1` = 0,`good2` = 0 WHERE `id` = "' . $u->tfer['id'] . '" LIMIT 1'
|
|
);
|
|
}
|
|
}
|
|
}
|
|
if ($u->info['id'] == $u->tfer['uid1']) {
|
|
$js .= 'refmoney(' . $u->round2($u->tfer['money2']) . ',' . $u->round2($u->tfer['money1']) . ');';
|
|
} else {
|
|
$js .= 'refmoney(' . $u->round2($u->tfer['money1']) . ',' . $u->round2($u->tfer['money2']) . ');';
|
|
}
|
|
}
|
|
if ($js != '') {
|
|
echo '<script>' . $js . '</script>';
|
|
}
|
|
} else {
|
|
echo '<script>location="main.php?transfer&rnd=' . $code . '";</script>';
|
|
}
|
|
} else {
|
|
echo '<script>location="main.php?transfer&exit_transfer&rnd=' . $code . '";</script>';
|
|
}
|
|
}
|