change owner

This commit is contained in:
lopar 2019-06-21 02:55:10 +03:00
parent dd5eeb67b5
commit 92e8c35e14

View File

@ -38,7 +38,7 @@ if (!empty($_POST['login']) AND $_POST['action'] == 'add_member' AND $polno[$use
} else $status = 'Не хватает денег, или его попросту не существует.';
}
if (!empty($_POST['login']) AND $_POST['action'] == 'remove_member' AND $polno[$user['id']][0] == 1) { //увольнение
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']);
@ -47,13 +47,13 @@ if (!empty($_POST['login']) AND $_POST['action'] == 'remove_member' AND $polno[$
}
}
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;'));
if (!empty($_POST['login']) AND $_POST['action'] == 'change_owner' AND $klan['glava'] == $_SESSION['uid']) { //смена главы
$sok = db::c()->query('SELECT `id` FROM `users` WHERE `klan` = "?s" AND `login` = "?s"', $klan['id'], $_POST['login'])->fetch_assoc();
//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'] . ';');
db::c()->query('UPDATE `clans` SET `glava` = ?i WHERE `id` = ?i', $sok['id'], $klan['id']);
db::c()->query('UPDATE `users` SET `status` = null WHERE `id` = ?i', $sok['id']);
db::c()->query('UPDATE `users` SET `status` = "?s" WHERE `id` = ?i', 'Боец', $_SESSION['uid']);
$klan['glava'] = $sok['id'];
}
@ -85,6 +85,9 @@ if (!empty($_POST['login3']) && $klan['glava'] == $user['id']) { //смена г
<span id="edit_status">
<input type="submit" onclick="use('edit_status')" value="Редактировать статус">
</span>
<span id="change_owner">
<input type="submit" onclick="use('change_owner')" value="Сменить главу клана">
</span>
<?php