diff --git a/klan.php b/klan.php
index 5519b81..6f08292 100644
--- a/klan.php
+++ b/klan.php
@@ -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` = \'Глава клана\' 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']) { //смена г
+
+
+