Просмотр файла chat/inc/admin_form.php

Размер файла: 3.2Kb
  1. <?
  2. if (user_access('chat_room') && isset($_GET['set']) && is_numeric($_GET['set']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_rooms` WHERE `id` = '".intval($_GET['set'])."'"),0)==1)
  3. {
  4.  
  5. $room=mysql_fetch_assoc(mysql_query("SELECT * FROM `chat_rooms` WHERE `id` = '".intval($_GET['set'])."' LIMIT 1"));
  6.  
  7. echo "<form action='?set=$room[id]&amp;ok' method='post'>";
  8. echo "Название комнаты:<br />\n<input type='text' name='name' value='$room[name]' /><br />\n";
  9. echo "Позиция:<br />\n<input type='text' name='pos' value='$room[pos]' /><br />\n";
  10. echo "Описание:<br />\n<input type='text' name='opis' value='$room[opis]' /><br />\n";
  11.  
  12. echo "Боты:<br />\n<select name=\"bots\">\n";
  13. echo "<option value='0'".(($room['umnik']==0 && $room['shutnik']==0)?' selected="selected"':null).">Нет</option>\n";
  14. echo "<option value='1'".(($room['umnik']==1 && $room['shutnik']==0)?' selected="selected"':null).">$set[chat_umnik]</option>\n";
  15. echo "<option value='2'".(($room['umnik']==0 && $room['shutnik']==1)?' selected="selected"':null).">$set[chat_shutnik]</option>\n";
  16. echo "<option value='3'".(($room['umnik']==1 && $room['shutnik']==1)?' selected="selected"':null).">$set[chat_umnik] и $set[chat_shutnik]</option>\n";
  17. echo "</select><br />\n";
  18.  
  19. echo "<input class='submit' type='submit' value='Применить' /><br />\n";
  20. echo "<a href='?delete=$room[id]'>Удалить</a><br />\n";
  21. echo "<a href='?cancel=$passgen'>Отмена</a><br />\n";
  22. echo "</form>";
  23. }
  24.  
  25. if (user_access('chat_clear') && isset($_GET['act']) && $_GET['act']=='clear')
  26. {
  27.  
  28. echo "<div class=\"err\">";
  29.  
  30. echo "Очистить чат?<br />\n";
  31. echo "<a href=\"?act=clear2\">Да</a> \n";
  32. echo "<a href=\"?\">Нет</a><br />\n";
  33. echo "</div>";
  34. }
  35.  
  36. if (user_access('chat_room') && (isset($_GET['act']) && $_GET['act']=='add_room' || mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_rooms`"),0)==0))
  37. {
  38. echo "<form class=\"foot\" action=\"?act=add_room&amp;ok\" method=\"post\">";
  39. echo "Название комнаты:<br />\n";
  40. echo "<input type='text' name='name' value='' /><br />\n";
  41.  
  42. $pos=mysql_result(mysql_query("SELECT MAX(`pos`) FROM `chat_rooms`"), 0)+1;
  43. echo "Позиция:<br />\n";
  44. echo "<input type='text' name='pos' value='$pos' /><br />\n";
  45.  
  46.  
  47. echo "Описание:<br />\n";
  48. echo "<input type='text' name='opis' value='' /><br />\n";
  49.  
  50. echo "Боты:<br />\n<select name=\"bots\">\n";
  51.  
  52. echo "<option value='0'>Нет</option>\n";
  53. echo "<option value='1'>$set[chat_umnik]</option>\n";
  54. echo "<option value='2'>$set[chat_shutnik]</option>\n";
  55. echo "<option value='3'>$set[chat_umnik] и $set[chat_shutnik]</option>\n";
  56. echo "</select><br />\n";
  57.  
  58. echo "<input class=\"submit\" type=\"submit\" value=\"Создать комнату\" /><br />\n";
  59. echo "&laquo;<a href=\"?\">Отмена</a><br />\n";
  60. echo "</form>";
  61. }
  62.  
  63. echo "<div class=\"foot\">\n";
  64. if (user_access('chat_clear'))
  65. echo "&raquo;<a href=\"?act=clear\">Очистить чат от сообщений</a><br />\n";
  66. if (user_access('chat_room') && mysql_result(mysql_query("SELECT COUNT(*) FROM `chat_rooms`"),0)>0)
  67. echo "&raquo;<a href=\"?act=add_room\">Создать комнату</a><br />\n";
  68. echo "</div>\n";
  69. ?>