query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('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'], input::post('comment')); $status = 'Контакт добавлен.'; } } if (input::post('friendremove')) { $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('friendremove'))->fetch_assoc(); $q2 = db::c()->query('SELECT 1 FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); if (!$q['id'] OR !$q2->getNumRows()) $status = 'Персонаж не найден.'; else { db::c()->query('DELETE FROM `friends` WHERE `user` = ?i AND `friend` = ?i', $_SESSION['uid'], $q['id']); $status = 'Контакт удалён.'; } } if (input::post('friendedit')) { $q = db::c()->query('SELECT `id` FROM `users` WHERE `login` = "?s"', input::post('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', input::post('comment'), $_SESSION['uid'], $q['id']); $status = 'Контакт изменён.'; } } $admins_list = db::c()->query('SELECT `id` FROM `users` WHERE `admin` = 1 ORDER BY `login` ASC', (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() . ""; ?> |