room['file'] != 'post') { return; }/* Разделы почты */ $r = 1; $otdel = 1; function sendSysChat(string $city, string $to, string $message, int $timeModifier) { $cmsg = new ChatMessage(); $cmsg->setCity($city); $cmsg->setTo($to); $cmsg->setText($message); $cmsg->setTime(-time() + $timeModifier * 60); $cmsg->setType(5); $cmsg->setIsAlert(true); (new Chat())->sendMsg($cmsg); } if (isset($_POST['torzer'])) { $_GET['r'] = $_POST['torzer']; } if (isset($_POST['tootdel'])) { if ($_POST['tootdel'] == 2) { $otdel = 2; } elseif ($_POST['tootdel'] == 3) { $otdel = 3; } elseif ($_POST['tootdel'] == 4) { $otdel = 4; } elseif ($_POST['tootdel'] == 6) { $otdel = 6; } } if (isset($_GET['r'])) { if ($_GET['r'] == 2) { $r = 2; } elseif ($_GET['r'] == 3) { $r = 3; } elseif ($_GET['r'] == 4) { $r = 4; } } $tmgo = 30; //минут if (isset($_POST['touser'])) { $pu = mysql_fetch_array( mysql_query( 'SELECT * FROM `users` WHERE `login` = "' . mysql_real_escape_string( $_POST['touser'] ) . '" ORDER BY `id` ASC LIMIT 1' ) ); if ($u->info['allLock'] > time()) { $pu = false; echo ''; } elseif ($u->info['transfers'] < 1) { $pu = false; echo ''; } } if (!isset($pu['id'])) { unset($_POST['touser']); } if ($r == 1) { if (isset($_POST['itm_post']) && (int)$_POST['itm_post'] > 0) { $itm = mysql_fetch_array( mysql_query( 'SELECT `iu`.*,`im`.*,`iu`.item_id as item_id FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `im`.`id` = `iu`.`item_id` WHERE `iu`.`uid`="' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . mysql_real_escape_string( $_POST['itm_post'] ) . '" LIMIT 1' ) ); if ($u->info['align'] == 2) { $u->error = 'Хаосники не могут передавать кредиты и предметы'; } elseif ($u->info['palpro'] < time()) { $u->error = 'Нужна проверка на чистоту для использования телеграфа'; } elseif (isset($itm['id'])) { $itm['id'] = mysql_real_escape_string(round((int)$_POST['itm_post'])); $see1 = 1; $po = \Core\ConversionHelper::dataStringToArray($itm['data']); $po['toclan1'] = explode('#', $po['toclan']); $po['toclan1'] = $po['toclan1'][0]; if ($po['toclan1'] > 0) { $see1 = 0; } if ($po['frompisher'] > 0) { $see1 = 0; } if ($itm['gift'] > 0) { $see1 = 0; } if ($po['sudba'] > 0) { $see1 = 0; } if ($po['zazuby'] > 0) { $see1 = 0; } if ($see1 == 1) { $x = $u->itemsX($itm['id']); $mny = round(1 + $itm['price1'] / 100 * 7); if ($x > 1) { $mny += ($x - 1) * $mny; } if ($u->info['money'] >= $mny) { if ($x > 1) { mysql_query( 'UPDATE `items_users` SET `uid` = "-51' . $pu['id'] . '",`lastUPD` = "' . (time( ) + $tmgo * 60) . '" WHERE `uid`="' . $u->info['id'] . '" AND `item_id`="' . $itm['item_id'] . '" AND `inGroup` = "' . mysql_real_escape_string( $itm['inGroup'] ) . '" LIMIT ' . $x ); $itm['name'] .= ' (x' . $x . ')'; } else { mysql_query( 'UPDATE `items_users` SET `uid` = "-51' . $pu['id'] . '",`lastUPD` = "' . (time( ) + $tmgo * 60) . '" WHERE `id` = "' . mysql_real_escape_string( $itm['id'] ) . '" LIMIT 1' ); } $u->info['money'] -= $mny; mysql_query( 'UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' ); $u->error = 'Вы успешно передали "' . $itm['name'] . '" к персонажу "' . $pu['login'] . '" за ' . $mny . ' кр. '; $u->info['transfers']--; mysql_query( 'UPDATE `stats` SET `transfers` = "' . $u->info['transfers'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' ); //логи $txt = 'Предмет от ' . $u->info['login'] . ': "' . $itm['name'] . '". Прибытие: ' . date( 'd.m.Y H:i', (time() + $tmgo * 60) ) . ''; mysql_query( 'INSERT INTO `post` (`text`,`uid`,`time`,`sender_id`,`item_id`,`money`) VALUES ("' . mysql_real_escape_string( $txt ) . '", "' . $pu['id'] . '","' . time() . '","' . $u->info['id'] . '","' . mysql_real_escape_string( $itm['id'] ) . '","0")' ); $txt = 'Отправление предмета к ' . $pu['login'] . ': "' . $itm['name'] . '". Прибытие: ' . date( 'd.m.Y H:i', (time() + $tmgo * 60) ) . ''; mysql_query( 'INSERT INTO `post` (`text`,`sender_id`,`time`,`uid`,`item_id`,`money`) VALUES ("' . mysql_real_escape_string( $txt ) . '", "-' . $pu['id'] . '","' . time() . '","' . $u->info['id'] . '","' . mysql_real_escape_string( $itm['id'] ) . '","0")' ); //чат sendSysChat($pu['city'], $pu['login'], "Получена новая почта от {$u->info['login']}", $tmgo); } else { $u->error = 'Не достаточно денежных средств'; } } else { $u->error = 'Подходящий предмет не найден'; } } else { $u->error = 'Предмет не найден'; } } } elseif ($r == 3) { if (isset($_GET['itm_take'])) { $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`.`uid`="-51' . $u->info['id'] . '" AND `iu`.`delete`="0" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`id` = "' . mysql_real_escape_string( $_GET['itm_take'] ) . '" LIMIT 1' ) ); if ($u->info['align'] == 2) { $u->error = 'Хаосники не могут передавать кредиты и предметы'; } elseif ($u->info['palpro'] < time()) { $u->error = 'Нужна проверка на чистоту для использования телеграфа'; } elseif (isset($itm['id'])) { if ($itm['item_id'] == 1220) { //Прием денег $post = mysql_fetch_array( mysql_query( 'SELECT * FROM `post` WHERE `item_id` = "0" AND `money` LIKE "' . $itm['1price'] . '" AND `uid` = "' . $u->info['id'] . '" AND `finish` = "0" ORDER BY `id` DESC LIMIT 1' ) ); if (isset($post['id'])) { if ($post['sender_id'] < 0) { $post['sender_id'] = -$post['sender_id']; } $pup = mysql_fetch_array( mysql_query('SELECT * FROM `users` WHERE `id` = "' . $post['sender_id'] . '" LIMIT 1') ); if ($post['sender_id'] == 0) { $pup = [ 'login' => 'Администрация', 'id' => 0, ]; } $u->error = 'Вы успешно забрали ' . $itm['1price'] . ' кр. от ' . $pup['login']; $u->info['money'] += $itm['1price']; mysql_query( 'UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' ); mysql_query( 'UPDATE `post` SET `finish` = "' . time( ) . '" WHERE `item_id` = "' . $post['id'] . '" ORDER BY `id` DESC LIMIT 1' ); mysql_query( 'UPDATE `items_users` SET `delete` = "' . time( ) . '",`uid` = "' . $u->info['id'] . '" WHERE `id` = "' . mysql_real_escape_string( $_GET['itm_take'] ) . '" LIMIT 1' ); $u->info['transfers']--; mysql_query( 'UPDATE `stats` SET `transfers` = "' . $u->info['transfers'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' ); //логи $txt = 'Деньги для ' . $u->info['login'] . ': ' . $itm['1price'] . ' кр. Доставлены.'; mysql_query( 'INSERT INTO `post` (`text`,`uid`,`time`,`sender_id`,`item_id`,`money`) VALUES ("' . mysql_real_escape_string( $txt ) . '", "' . $pup['id'] . '","' . time() . '","' . $u->info['id'] . '","' . mysql_real_escape_string( $_GET['itm_take'] ) . '","2")' ); $txt = 'Деньги от ' . $pup['login'] . ': ' . $itm['1price'] . ' кр. Получены.'; mysql_query( 'INSERT INTO `post` (`text`,`sender_id`,`time`,`uid`,`item_id`,`money`) VALUES ("' . mysql_real_escape_string( $txt ) . '", "-' . $pup['id'] . '","' . time() . '","' . $u->info['id'] . '","' . mysql_real_escape_string( $_GET['itm_take'] ) . '","2")' ); } } else { //Прием вещей $post = mysql_fetch_array( mysql_query( 'SELECT `p`.id,`p`.sender_id, count(`iuu`.id) as inGroupCount, `iu`.id as idItem, `iuu`.item_id, `iuu`.inGroup FROM `post` as `p` LEFT JOIN `items_users` as `iu` ON (`iu`.id = `p`.item_id ) LEFT JOIN `items_users` as `iuu` ON (`iuu`.item_id = `iu`.item_id AND `iu`.`inGroup` = `iu`.`inGroup` AND `iuu`.`uid` = `iu`.`uid`) WHERE (`p`.`sender_id` = "' . $u->info['id'] . '" OR `p`.`sender_id` = "-' . $u->info['id'] . '") AND `iu`.`id` = "' . mysql_real_escape_string( $_GET['itm_take'] ) . '" GROUP BY `iu`.id ORDER BY `iu`.`id` DESC LIMIT 1' ) ); if (isset($post['id'])) { if ($post['sender_id'] < 0) { $post['sender_id'] = -$post['sender_id']; } if ($post['inGroup'] > 0) { $x = $u->itemsX(mysql_real_escape_string($post['idItem'])); if ($x > 1) { $item = mysql_query( 'UPDATE `items_users` SET `uid` = "' . $u->info['id'] . '", `lastUPD` = "' . time( ) . '" WHERE `item_id` = "' . mysql_real_escape_string( $post['item_id'] ) . '" AND `inGroup` = "' . mysql_real_escape_string( $post['inGroup'] ) . '" AND `uid` = "-51' . mysql_real_escape_string($u->info['id']) . '" LIMIT ' . $x ); $itm['name'] .= ' (x' . $x . ')'; } else { $item = mysql_query( 'UPDATE `items_users` SET `uid` = "' . $u->info['id'] . '", `lastUPD` = "' . time( ) . '" WHERE `id` = "' . mysql_real_escape_string($_GET['itm_take']) . '" LIMIT 1' ); } } else { $item = mysql_query( 'UPDATE `items_users` SET `uid` = "' . $u->info['id'] . '", `lastUPD` = "' . time( ) . '" WHERE `id` = "' . mysql_real_escape_string($_GET['itm_take']) . '" LIMIT 1' ); } if ($item) { mysql_query( 'UPDATE `post` SET `finish` = "' . time() . '" WHERE `id` = "' . mysql_real_escape_string( $post['id'] ) . '" ORDER BY `id` DESC LIMIT 1' ); $u->info['transfers']--; mysql_query( 'UPDATE `stats` SET `transfers` = "' . $u->info['transfers'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1' ); $u->error = 'Вы успешно забрали "' . $itm['name'] . '"'; $pup = mysql_fetch_array( mysql_query('SELECT * FROM `users` WHERE `id` = "' . $post['sender_id'] . '" LIMIT 1') ); if ($post['sender_id'] == 0) { $pup = [ 'login' => 'Администрация', 'id' => 0, ]; } //логи $txt = 'Предмет для ' . $u->info['login'] . ': "' . $itm['name'] . '". Доставлен.'; mysql_query( 'INSERT INTO `post` (`text`,`uid`,`time`,`sender_id`,`item_id`,`money`,`finish`) VALUES ("' . mysql_real_escape_string( $txt ) . '","' . $pup['id'] . '","' . time( ) . '","' . $u->info['id'] . '","' . mysql_real_escape_string( $_GET['itm_take'] ) . '","2", "' . time() . '")' ); $txt = 'Предмет от ' . $pup['login'] . ': "' . $itm['name'] . '". Получен.'; mysql_query( 'INSERT INTO `post` (`text`,`sender_id`,`time`,`uid`,`item_id`,`money`,`finish`) VALUES ("' . mysql_real_escape_string( $txt ) . '","-' . $pup['id'] . '","' . time( ) . '","' . $u->info['id'] . '","' . mysql_real_escape_string( $_GET['itm_take'] ) . '","2", "' . time() . '")' ); } else { $u->error = 'Не удалось забрать предмет (' . $itm['id'] . ')'; } } else { $u->error = 'Не удалось найти предмет'; } } } else { $u->error = 'Предмет не найден'; } if ($u->error != '') { echo '
Почтовое отделение
= $u->microLogin($u->info['id'], 1) ?>
= $u->error; ?>
|
error != '') {
echo '' . $u->error . '';
}
if ($re != '') {
echo '' . $re . '';
}
?>
Деньги: = $u->info['money'] ?> кр.
|