512){ $err[] = 'Сообщение слишком длинное'; } elseif (strlen2($msg) < 2){ $err[] = 'Короткое сообщение'; } elseif (mysql_result(mysql_query("SELECT COUNT(*) FROM `sexwars_chat` WHERE `id_user` = '$user[id]' AND `id_tournament` = '$sexwars[id]' AND `msg` = '" . my_esc($msg) . "' LIMIT 1"),0) != 0) { $err[] = 'Ваше сообщение повторяет предыдущее'; } if (!isset($err)) { // Начисление баллов за активность include_once H.'sys/add/user.active.php'; if (isset($ank_reply['id'])) { $ank_reply = get_user($ank_reply['id']); if ($ank_reply['id'] != $user['id'] && $ank_reply['url'] != $_SERVER['PHP_SELF']) { mysql_query("INSERT INTO `notification` (`avtor`, `id_user`, `type`, `time`) VALUES ('$user[id]', '$ank_reply[id]', 'sexwars', '$time')"); } } mysql_query("INSERT INTO `sexwars_chat` (id_user, time, msg, id_tournament, sex) values('$user[id]', '$time', '" . my_esc($msg) . "', '$sexwars[id]', '$sex')"); $_SESSION['message'] = 'Сообщение успешно добавлено'; header ('Location: ?id=' . $sexwars['id']); exit; } } /** * Регистрация в игре */ if (isset($_GET['start']) && !isset($ank['id']) && $sexwars['active'] == 1) { mysql_query("INSERT INTO `sexwars_users`(`time`, `sex`, `id_tournament`, `id_user`) VALUES ('$time', '$sex', '$sexwars[id]', '$user[id]')"); header('Location: ?id=' . $sexwars['id']); exit; } if ($ank['id_tournament'] != $sexwars['id'] && $sexwars['active'] == 1) { mysql_query("UPDATE `sexwars_users` SET `id_tournament` = '$sexwars[id]', `count_weapon` = '0' WHERE `id_user` = '$user[id]' LIMIT 1"); } if ($sexwars['active'] == 1 && ($sexwars['female'] == 100 || $sexwars['male'] == 100)) { $win = ($sexwars['female'] == 100 ? 'female' : 'male'); mysql_query("UPDATE `sexwars` SET `active` = '0', `win` = '$win', `time_end` = '$time' WHERE `id` = '$sexwars[id]' LIMIT 1"); $q = mysql_query("SELECT * FROM `sexwars_users` WHERE `id_tournament` = '$sexwars[id]' AND `sex` = '$win' ORDER BY `count_weapon` DESC LIMIT 5"); while($wars = mysql_fetch_assoc($q)) { $msg = 'Поздравляем!!! Ваша команда победила в игре [url=/plugins/games/sexwar/]Война Полов[/url], вам начислено ' . ($config['balls'] > 0 ? des2num(ceil($config['balls'] * $wars['count_weapon']), $config['balls_name']) . ', ' : '') . ($config['money'] > 0 ? des2num(ceil($config['money'] * $wars['count_weapon']), $config['coins_name']) . ', ' : '') . ($config['rating'] > 0 ? des2num(ceil($config['rating'] * $wars['count_weapon']), $config['rating_name']) . ', ' : '') . ' удачи в следующей битве! :)'; mysql_query("UPDATE `user` SET `balls` = `balls` + '" . ceil($config['balls'] * $wars['count_weapon']) . "', `money` = `money` + '" . ceil($config['money'] * $wars['count_weapon']) . "', `rating` = `rating` + '" . ceil($config['rating'] * $wars['count_weapon']) . "' WHERE `id` = '$wars[id_user]' LIMIT 1"); mysql_query("INSERT INTO `mail` (`id_user`, `id_kont`, `msg`, `time`) values('0', '$wars[id_user]', '" . my_esc($msg) . "', '$time')"); } } /** * Действие */ if (isset($_GET['act']) && $sexwars['active'] == 1) { $glums_id = $_GET['act']; if (!isset($glums[$glums_id])) { $err[] = 'Такого ляпа не существует'; } if ($ank['time_reboot'] > $time) { $err[] = 'Идет перезарядка..'; } if (!isset($err)) { $glum['type'] = $glums_id; $glum['id'] = mt_rand(1, $glums[$glums_id]); $glum['style'] = array('top' => mt_rand(-10, 90), 'left' => mt_rand(-10, 90), 'rotate' => mt_rand(0, 360)); mysql_query("INSERT INTO `sexwars_weapons` (`time`, `sex`, `id_tournament`, `id_user`, `style`, `type`, `id_weapon`) VALUES ('$time', '$sex', '$sexwars[id]', '$user[id]', '" . serialize($glum['style']) . "', '" . $glum['type'] . "', '" . $glum['id'] . "')"); mysql_query("UPDATE `sexwars_users` SET `time_reboot` = '" . ($time + $config['reboot']) . "', `count_weapon` = `count_weapon` + '1', `rating` = `rating` + '1' WHERE `id_user` = '$user[id]' LIMIT 1"); mysql_query("UPDATE `sexwars` SET `" . $sex . "` = `" . $sex . "` + '1' WHERE `id` = '$sexwars[id]' LIMIT 1"); header('Location: ?id=' . $sexwars['id']); exit; } } } if (isset($_GET['delete']) && user_access('guest_delete')) { $delete = (int) $_GET['delete']; mysql_query("DELETE FROM `sexwars_chat` WHERE `id` = '$delete' LIMIT 1"); $_SESSION['message'] = 'Сообщение успешно удалено'; header('Location: ?id=' . $sexwars['id']); exit; } $set['title'] = 'Война полов'; include_once H.'sys/inc/thead.php'; title(); aut(); err(); ?>
%
%
' : '')?>
' : '')?>
Я: Участников ( '0'"), 0)?>) Я: Участников ( '0'"), 0)?>)
Победители команда «»
Время завершения
Победители битвы №
)
Вступить в битву
Чат «Война Полов»
' . $insert . '
'; } ?> Обновить
Нет сообщений
[Ответить] '; //} echo ' (' . vremja($post['time']) . ')
'; echo output_text($post['msg']); ?> *
1) { str('?id=' . $sexwars['id'] . '&', $k_page, $page); } ?>
Главная игры