user removal
This commit is contained in:
parent
399a9581a1
commit
2b1cbc69a5
73
klan.php
73
klan.php
@ -27,6 +27,36 @@ if (isset($_POST['kr']) && ($_POST['kolv'] > 0)) {
|
||||
} else $status = 'Не хватает денег!';
|
||||
}
|
||||
|
||||
if (!empty($_POST['login']) AND $_POST['action'] == 'add_member' AND $polno[$user['id']][0] == 1) {
|
||||
$sok = db::c()->query('SELECT `id`,`level` FROM `users` WHERE `klan` = "?s" AND `align` = 0 AND `login` = "?s"', '', $_POST['login'])->fetch_assoc();
|
||||
$proverka = db::c()->query('SELECT 1 FROM `effects` WHERE `type` = 20 AND `owner` = ?i', $sok['id'])->getNumRows();
|
||||
if (!$proverka) echo "Нет проверки!";
|
||||
elseif ($sok['level'] > 0 && $user['money'] >= 100) {
|
||||
mysql_query('update `users` set `money` = `money` - 100 WHERE `id` = ' . $_SESSION['uid'] . ';');
|
||||
mysql_query('update `users` set `status`= \'боец\', `klan` = \'' . $klan['id'] . '\', `align` = \'' . $klan['align'] . '\' WHERE `id` = ' . $sok['id'] . ';');
|
||||
$status = 'Персонаж «'. $_POST['login'] .'» успешно принят в клан.';
|
||||
} else $status = 'Не хватает денег, или его попросту не существует.';
|
||||
}
|
||||
|
||||
if (!empty($_POST['login']) AND $_POST['action'] == 'remove_member' AND $polno[$user['id']][0] == 1) { //увольнение
|
||||
$sok = db::c()->query('SELECT `id` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"', $klan['id'], $_POST['login'])->fetch_assoc();
|
||||
if ($sok['id'] != $klan['glava'] AND $user['money'] >= 30) {
|
||||
db::c()->query('UPDATE `users` SET `money` = `money` - 30 WHERE `id` = ?i', $_SESSION['uid']);
|
||||
db::c()->query('UPDATE `users` SET `klan` = null, `align` = 0 WHERE `id` = ?i', $sok['id']);
|
||||
$status = 'Персонаж «'. $_POST['login'] .'» покинул клан.';
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_POST['login3']) && $klan['glava'] == $user['id']) { //смена главы
|
||||
$sok = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `klan` = \'' . $klan['id'] . '\' AND `login` = \'' . $_POST['login3'] . '\' LIMIT 1;'));
|
||||
//mysql_query('update `users` set `money` = `money` - 30 WHERE `id` = '.$_SESSION['uid'].';');
|
||||
//mysql_query('update `users` set `klan` = \'\', `align` = 0 WHERE `id` = '.$sok['id'].';');
|
||||
mysql_query('update `clans` set `glava` = \'' . $sok['id'] . '\' WHERE `id` = ' . $klan['id'] . ';');
|
||||
mysql_query('update `users` set `status` = \'<font color=#008080><b>Глава клана</b></font>\' WHERE `id` = ' . $sok['id'] . ';');
|
||||
mysql_query('update `users` set `status` = \'боец\' WHERE `id` = ' . $user['id'] . ';');
|
||||
$klan['glava'] = $sok['id'];
|
||||
}
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
@ -46,8 +76,16 @@ if (isset($_POST['kr']) && ($_POST['kolv'] > 0)) {
|
||||
else echo 'У клана пока нет Замка<br><br>';
|
||||
?>
|
||||
|
||||
<span id="edit_status"><input type="submit" onclick="use('edit_status')"
|
||||
value="Редактировать статус"></span>
|
||||
<span id="add_member">
|
||||
<input type="submit" onclick="use('add_member')" value="Принять в клан">
|
||||
</span>
|
||||
<span id="remove_member">
|
||||
<input type="submit" onclick="use('remove_member')" value="Выгнать из клана">
|
||||
</span>
|
||||
<span id="edit_status">
|
||||
<input type="submit" onclick="use('edit_status')" value="Редактировать статус">
|
||||
</span>
|
||||
|
||||
<?php
|
||||
|
||||
if (!empty($_POST['login'])) {
|
||||
@ -136,36 +174,7 @@ if (isset($_POST['kr']) && ($_POST['kolv'] > 0)) {
|
||||
|
||||
|
||||
}
|
||||
if (!empty($_POST['login3']) && $klan['glava'] == $user['id']) {
|
||||
$sok = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `klan` = \'' . $klan['id'] . '\' AND `login` = \'' . $_POST['login3'] . '\' LIMIT 1;'));
|
||||
//mysql_query('update `users` set `money` = `money` - 30 WHERE `id` = '.$_SESSION['uid'].';');
|
||||
//mysql_query('update `users` set `klan` = \'\', `align` = 0 WHERE `id` = '.$sok['id'].';');
|
||||
mysql_query('update `clans` set `glava` = \'' . $sok['id'] . '\' WHERE `id` = ' . $klan['id'] . ';');
|
||||
mysql_query('update `users` set `status` = \'<font color=#008080><b>Глава клана</b></font>\' WHERE `id` = ' . $sok['id'] . ';');
|
||||
mysql_query('update `users` set `status` = \'боец\' WHERE `id` = ' . $user['id'] . ';');
|
||||
$klan['glava'] = $sok['id'];
|
||||
}
|
||||
if (!empty($_POST['login2']) && $polno[$user['id']][0] == 1) {
|
||||
$sok = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `klan` = \'\' AND `align` = \'0\' AND `login` = \'' . $_POST['login2'] . '\' LIMIT 1;'));
|
||||
$eff = mysql_fetch_array(mysql_query("SELECT * FROM `effects` WHERE `owner` = '" . $sok['id'] . "' AND `type` = 20 LIMIT 1;"));
|
||||
if (!$eff) {
|
||||
echo "Нет проверки!";
|
||||
} elseif ($sok['level'] > 0 && $user['money'] >= 100) {
|
||||
echo 'Персонаж "', $sok['login'], '" успешно принят в клан.';
|
||||
mysql_query('update `users` set `money` = `money` - 100 WHERE `id` = ' . $_SESSION['uid'] . ';');
|
||||
mysql_query('update `users` set `status`= \'боец\', `klan` = \'' . $klan['id'] . '\', `align` = \'' . $klan['align'] . '\' WHERE `id` = ' . $sok['id'] . ';');
|
||||
} else {
|
||||
echo "Не хватает денег, или его попросту не существует.";
|
||||
}
|
||||
}
|
||||
if (!empty($_POST['login1']) && $polno[$user['id']][0] == 1) {
|
||||
$sok = mysql_fetch_array(mysql_query('SELECT * FROM `users` WHERE `klan` = \'' . $klan['id'] . '\' AND `login` = \'' . $_POST['login1'] . '\' LIMIT 1;'));
|
||||
if ($sok && $user['money'] >= 30 && $klan['glava'] != $sok['id']) {
|
||||
echo 'Персонаж "', $sok['login'], '" покинул клан.';
|
||||
mysql_query('update `users` set `money` = `money` - 30 WHERE `id` = ' . $_SESSION['uid'] . ';');
|
||||
mysql_query('update `users` set `klan` = \'\', `align` = 0 WHERE `id` = ' . $sok['id'] . ';');
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
echo 'У вашего клана нет реликтов, или глава клана вам их не предоставил. ;)';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user