query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendadd)->fetch_assoc(); $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); if (!$q['id']) { $status = 'Персонаж не найден.'; } elseif ($q['id'] == $_SESSION['uid']) { $status = 'Себя добавить нельзя.'; } elseif ($q2->getNumRows()) { $status = 'Персонаж уже есть в списке.'; } else { db::c()->query('INSERT INTO `friends` (`user`, `friend`, `comment`) VALUES (?i,?i,"?s")', $_SESSION['uid'], $q['id'], $comment); $status = 'Контакт добавлен.'; } } if ($friendremove) { $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendremove)->fetch_assoc(); $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); if (!$q['id'] || !$q2->getNumRows()) { $status = 'Персонаж не найден.'; } else { db::c()->query('DELETE FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); $status = 'Контакт удалён.'; } } if ($friendedit) { $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', $friendedit)->fetch_assoc(); $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); if (!$q2['friend']) { $status = 'Персонаж не найден.'; } else { db::c()->query('UPDATE `friends` SET `comment` = "?s" WHERE `user` = ?i AND `friend` = ?i', $comment, $_SESSION['uid'], $q['id']); $status = 'Контакт изменён.'; } } $admins_list = db::c()->query('SELECT `id` FROM `users` WHERE `admin` = 1 ORDER BY `login`', (time() - 60)); $contacts_list = db::c()->query('SELECT `friend`,`comment` FROM `friends` WHERE `friend` > 0 AND `user` = ?i', $_SESSION['uid']); ?>
|
Администраторыfetch_assoc()) echo Nick::id($row['id'])->full() . ""; ?> |