var elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
";
if (!defined('GAME')) {
die();
}
if ($u->info['exp'] > 100000 && isset($_GET['ignore'])) {
$_POST['friendadd'] = $_GET['ignore'];
$_POST['group'] = 3;
$_POST['comment'] = 'Игнор из чата';
$_POST['sd4'] = 1;
$_POST['x'] = 4;
$_POST['y'] = 6;
$frd = mysql_fetch_array(
mysql_query(
"SELECT id,login FROM `users` WHERE `login` = '" . mysql_real_escape_string(
$_POST['friendadd']
) . "' ORDER BY `id` LIMIT 1;"
)
);
$frd20 = mysql_fetch_array(
mysql_query(
"SELECT id,enemy,friend,notinlist,ignor FROM `friends` WHERE `user` = '" . $u->info['id'] . "' and (`friend`='" . $frd['id'] . "' or `enemy`='" . $frd['id'] . "' or `notinlist`='" . $frd['id'] . "' or `ignor`='" . $frd['id'] . "') LIMIT 1;"
)
);
if (isset($frd20['id'])) {
mysql_query('DELETE FROM `friends` WHERE `id` = "' . $frd20['id'] . '" LIMIT 1');
if ($frd20['ignor'] == $frd['id']) {
echo "Персонаж был успешно удален из списка игнорирования.";
echo '';
unset($_POST['friendadd'], $_POST['group'], $_POST['comment'], $_POST['sd4']);
}
}
}
$clr_fr = mysql_query('SELECT `id`,`friend`,`enemy`,`ignor` FROM `friends` WHERE `user` = "' . $u->info['id'] . '"');
while ($clr_frd = mysql_fetch_array($clr_fr)) {
if ($clr_frd['friend'] > 0) {
$usr_tst = mysql_fetch_array(
mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $clr_frd['friend'] . '" LIMIT 1')
);
} elseif ($clr_frd['enemy'] > 0) {
$usr_tst = mysql_fetch_array(
mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $clr_frd['enemy'] . '" LIMIT 1')
);
} elseif ($clr_frd['ignor'] > 0) {
$usr_tst = mysql_fetch_array(
mysql_query('SELECT `id`,`login` FROM `users` WHERE `id` = "' . $clr_frd['ignor'] . '" LIMIT 1')
);
}
if (!isset($usr_tst['id']) || $usr_tst['login'] == 'delete') {
mysql_query('DELETE FROM `friends` WHERE `id` = "' . $clr_frd['id'] . '" LIMIT 1');
}
}
$friend = mysql_fetch_array(
mysql_query("SELECT * FROM `friends` WHERE `user` = '" . $u->info['id'] . "' LIMIT 1;")
);
$st = Helper\Conversion::dataStringToArray($u->info['stats']);
$addfr = mysql_fetch_array(
mysql_query("SELECT count(`id`) FROM `friends` WHERE `user` = '" . $u->info['id'] . "';")
);
$addf = 20;
if ($st['os5'] > 0) {
$addf = 20 + ($st['os5'] * 5);
}
if ($addfr[0] < $addf) {
$canadd = 'onclick=\'findlogin2("Добавить в список", "main.php?friends", "friendadd", new Array("Друзья","Враги","Не в группе","Игнорирование"), new Array())\'';
} else {
$canadd = 'disabled';
}
if ($_POST['sd4'] && $_POST['friendadd']) {
$_POST['friendadd'] = htmlspecialchars($_POST['friendadd'], null);
if (/*preg_match("/__/",$_POST['friendadd']) ||*/
preg_match("/--/", $_POST['friendadd'])) {
echo "Персонаж не найден.";
} else {
$frd = mysql_fetch_array(
mysql_query(
"SELECT `id`,`login` FROM `users` WHERE `login` = '" . mysql_real_escape_string(
$_POST['friendadd']
) . "' LIMIT 1;"
)
);
$_POST['comment'] = htmlspecialchars($_POST['comment'], null);
$frd2 = mysql_fetch_array(
mysql_query(
"SELECT enemy,friend,notinlist,ignor FROM `friends` WHERE `user` = '" . $u->info['id'] . "' and (`friend`='" . $frd['id'] . "' or `enemy`='" . $frd['id'] . "' or `notinlist`='" . $frd['id'] . "' or `ignor`='" . $frd['id'] . "') LIMIT 1;"));
if (!$frd['id']) {
echo "Персонаж не найден.";
} elseif ($frd['id'] == $u->info['id']) {
echo "Себя добавить нельзя.";
} elseif (preg_match("/__/", $_POST['comment']) || preg_match("/--/", $_POST['comment'])) {
echo "Введен неверный текст.";
} elseif ($frd2['enemy'] or $frd2['friend'] or $frd2['notinlist'] or $frd2['ignor']) {
echo "Персонаж уже есть в вашем списке.";
} else {
$lign = '';
$uign = '';
if ($_POST['group'] == 0) {
$notinlist = 0;
$friend = $frd['id'];
$enemy = 0;
$ignor = 0;
} elseif ($_POST['group'] == 1) {
$notinlist = 0;
$friend = 0;
$enemy = $frd['id'];
$ignor = 0;
} elseif ($_POST['group'] == 3) {
$notinlist = 0;
$friend = 0;
$enemy = 0;
$ignor = $frd['id'];
$lign = $frd['login'];
$uign = $u->info['login'];
} else {
$notinlist = $frd['id'];
$friend = 0;
$enemy = 0;
$ignor = 0;
}
mysql_query(
"INSERT INTO `friends` (`user`, `friend`, `enemy`, `notinlist`, `comment`,`ignor`,`login_ignor`,`user_ignor`) VALUES(" . $u->info['id'] . ", " . $friend . ", " . $enemy . ", " . $notinlist . ", '" . mysql_real_escape_string($_POST['comment']) . "', '" . $ignor . "','" . $lign . "','" . $uign . "');");
echo "Персонаж " . $_POST['friendadd'] . " добавлен.";
if ($ignor > 0) {
echo '';
}
}
}
}
if ($_GET['friendremove']) {
$_GET['friendremove'] = htmlspecialchars($_GET['friendremove'], null);
if (preg_match("/__/", $_GET['friendremove']) || preg_match("/--/", $_GET['friendremove'])) {
echo "Персонаж не найден.";
} else {
$frd = mysql_fetch_array(
mysql_query(
"SELECT id FROM `users` WHERE `login` = '" . mysql_real_escape_string(
$_GET['friendremove']
) . "' LIMIT 1;"
)
);
if (!$frd['id']) {
echo "Персонаж не найден.";
} else {
$frd2 = mysql_fetch_array(
mysql_query(
"SELECT ignor,enemy,friend,notinlist FROM `friends` WHERE `user` = '" . $u->info['id'] . "' and (`friend`='" . $frd['id'] . "' or `enemy`='" . $frd['id'] . "' or `notinlist`='" . $frd['id'] . "' or `ignor`='" . $frd['id'] . "') LIMIT 1;"));
if (!$frd2['enemy'] && !$frd2['friend'] && !$frd2['ignor'] && !$frd2['notinlist']) {
echo "Персонаж не найден в вашем списке.";
} else {
$per = '';
if ($frd2['friend'] > 0) {
$per = " and `friend`='" . $frd2['friend'] . "'";
}
if ($frd2['enemy'] > 0) {
$per = " and `enemy`='" . $frd2['enemy'] . "'";
}
if ($frd2['notinlist'] > 0) {
$per = " and `notinlist`='" . $frd2['notinlist'] . "'";
}
if ($frd2['ignor'] > 0) {
$per = " and `ignor`='" . $frd2['ignor'] . "'";
}
if (mysql_query(
"DELETE FROM `friends` WHERE `user`='" . $u->info['id'] . "'" . $per . ";"
)) {
echo "Данные контакта " . $_GET['friendremove'] . " успешно удалены.";
echo '';
}
}
}
}
}
if ($_POST['friendedit']) {
$_POST['friendedit'] = htmlspecialchars($_POST['friendedit'], null);
if (preg_match("/__/", $_POST['friendedit']) || preg_match("/--/", $_POST['friendedit'])) {
echo "Персонаж не найден.";
} else {
$frd = mysql_fetch_array(
mysql_query(
"SELECT id FROM `users` WHERE `login` = '" . mysql_real_escape_string(
$_POST['friendedit']
) . "' LIMIT 1;"
)
);
$_POST['comment'] = htmlspecialchars($_POST['comment'], null);
if (empty($frd['id'])) {
echo "Персонаж не найден.";
} elseif ($frd['id'] == $u->info['id']) {
echo "Себя отредактировать нельзя.";
} elseif (preg_match("/__/", $_POST['comment']) || preg_match("/--/", $_POST['comment'])) {
echo "Введен неверный текст.";
} else {
if ($_POST['group'] == 0) {
$notinlist = 0;
$friend = $frd['id'];
$enemy = 0;
$ignor = 0;
} elseif ($_POST['group'] == 1) {
$notinlist = 0;
$friend = 0;
$enemy = $frd['id'];
$ignor = 0;
} elseif ($_POST['group'] == 3) {
$notinlist = 0;
$friend = 0;
$enemy = 0;
$ignor = $frd['id'];
} else {
$notinlist = $frd['id'];
$friend = 0;
$enemy = 0;
$ignor = 0;
}
$frd2 = mysql_fetch_array(
mysql_query(
"SELECT ignor,enemy,friend,notinlist FROM `friends` WHERE `user` = '" . $u->info['id'] . "' and (`friend`='" . $frd['id'] . "' or `enemy`='" . $frd['id'] . "' or `notinlist`='" . $frd['id'] . "' or `ignor`='" . $frd['id'] . "') LIMIT 1;"
)
);
if (!$frd2['enemy'] && !$frd2['friend'] && !$frd2['ignor'] && !$frd2['notinlist']) {
echo "Персонаж не найден в вашем списке.";
} else {
$per = '';
if ($frd2['friend'] > 0) {
$per = " and `friend`='" . $frd2['friend'] . "'";
}
if ($frd2['enemy'] > 0) {
$per = " and `enemy`='" . $frd2['enemy'] . "'";
}
if ($frd2['notinlist'] > 0) {
$per = " and `notinlist`='" . $frd2['notinlist'] . "'";
}
if ($frd2['ignor'] > 0) {
$per = " and `ignor`='" . $frd2['ignor'] . "'";
}
$comment = $_POST['comment'];
mysql_query(
"UPDATE `friends` SET `friend` = '" . mysql_real_escape_string($friend) . "',`enemy` = '" . $enemy . "',`notinlist` = '" . $notinlist . "',`comment` = '" . mysql_real_escape_string($comment) . "',`ignor` = '" . $ignor . "' WHERE `user`='" . $u->info['id'] . "'$per");
echo "Данные контакта " . $_POST['friendedit'] . " успешно изменены.";
if ($ignor > 0) {
echo '';
} else {
echo '';
}
}
}
}
}
function printDealersOnline(): void
{
global $u;
$query = 'select id from users where (inUser > 0 or online > unix_timestamp() - 120) and (align = 50 or align2 = 50)';
$stmt = Db::getColumn($query);
if (empty($stmt)) {
echo 'Нет алхимиков онлайн.';
} else {
foreach ($stmt as $dealerId) {
echo User::getLogin($dealerId) . '
';
}
}
}
function printBukmekersOnline(): void
{
global $u;
$query = 'select id from users where (inUser > 0 or online > unix_timestamp() - 120) and bukmeker = 1';
$stmt = Db::getColumn($query);
if (empty($stmt)) {
echo 'Нет букмекеров онлайн.';
} else {
foreach ($stmt as $dealerId) {
echo User::getLogin($dealerId) . '
';
}
}
}
function printModeratorsOnline(): void
{
global $u;
$query = 'select id from users where (inUser > 0 or online > unix_timestamp() - 120) and (align >= 1 and align <= 2 or align >=3 and align <=4 or align2 >= 1 and align2 <= 2 or align2 >=3 and align2 <=4)';
$stmt = Db::getColumn($query);
if (empty($stmt)) {
echo 'Нет модераторов онлайн.';
} else {
foreach ($stmt as $dealerId) {
echo User::getLogin($dealerId) . '
';
}
}
}
?>
|
|