- <?php
- if($status != "admin")
- {
- header("Location: ".$forumdir);
- } else
- {
- switch($_GET['mode'])
- {
- default:
- $mforums = mysql_query("SELECT * FROM `mforums` ORDER BY `pos` ASC");
- $forums = mysql_query("SELECT * FROM `forums` ORDER BY `pos` ASC");
- if($version == "wml")
- {
- header("Content-type: text/vnd.wap.wml; charset=utf-8");
- header("Cache-Control: no-cache");
- echo(doctype("Админка").'
- Модераторы: <br />');
- $modersq = mysql_query("SELECT `status`, `id`, `username` FROM `users` WHERE `status`='moderator'");
- while($moders = mysql_fetch_array($modersq))
- {
- echo($moders['username'].'[<a href="./?p=27&v=wml&sid='.$sid.'&mode=moder&m=0&id='.$moders['id'].'">Удалить</a>]<br />');
- }
-
- echo('- - - - <br />
- Добавить подфорум:<br />
- - - - - <br />
- Имя: <br />
- <input type="text" name="name" /><br />
- Позиция: <br />
- <input type="text" name="pos" format="*N" /><br />
- <anchor>[Добавить]
- <go href="./?p=27&v=wml&mode=add&sid='.$sid.'" method="post">
- <postfield name="name" value="$(name)" />
- <postfield name="pos" value="$(pos)" />
- </go></anchor><br />
- - - - - <br />
- Удалить подфорум: <br />
- <select name="id">');
- while($fnames = mysql_fetch_array($forums))
- {
- echo('<option value="'.$fnames['id'].'">'.$fnames['name'].'</option>');
- }
- echo('</select><br />
- <anchor>[Удалить]
- <go href="./?p=27&v=wml&sid='.$sid.'&mode=del" method="post">
- <postfield name="id" value="$(id)" />
- </go></anchor><br />
- - - - - <br />
- Добавить модерский подфорум:<br />
- - - - - <br />
- Имя: <br />
- <input type="text" name="name" /><br />
- Позиция: <br />
- <input type="text" name="pos" format="*N" /><br />
- <anchor>[Добавить]
- <go href="./?p=27&v=wml&mode=addm&sid='.$sid.'" method="post">
- <postfield name="name" value="$(name)" />
- <postfield name="pos" value="$(pos)" />
- </go></anchor><br />
- - - - - <br />
- Удалить модерский подфорум: <br />
- <select name="id">');
- while($fnamesm = mysql_fetch_array($mforums))
- {
- echo('<option value="'.$fnamesm['id'].'">'.$fnamesm['name'].'</option>');
- }
- echo('</select><br />
- <anchor>[Удалить]
- <go href="./?p=27&v=wml&sid='.$sid.'&mode=delm" method="post">
- <postfield name="id" value="$(id)" />
- </go></anchor><br />
- - - - - <br />
- <a href="./?p=0&v=wml&sid='.$sid.'">В форум</a>
- </p></card></wml>');
- } elseif($version == "xhtml")
- {
- echo
- "<html>\r\n",
- "<head>\r\n",
- "<title>Админка</title>\r\n",
- "</head>\r\n",
- "<body bgcolor=\"".$style['background']."\" link=\"".$style['link']."\" vlink=\"".$style['link']."\" text=\"#000000\">\r\n",
- "<table align=\"center\" border=\"0\" cellspacing=\"1\" cellpadding=\"5\" width=\"350\">\r\n",
- "<tr>\r\n",
- "<td align=\"center\" bgcolor=\"".$style['title']."\"><font color=\"#FFFFFF\"><b>Админка</b></font></td>\r\n",
- "</tr>\r\n",
- "<tr bgcolor=\"".$style['text']."\"><td>\r\n",
- "<b><u>Модераторы:</b></u>\r\n</td></tr>",
- "<tr>\r\n<td bgcolor=\"".$style['text']."\">\r\n";
- $modersq = mysql_query("SELECT `status`, `id`, `username` FROM `users` WHERE `status`='moderator'");
- while($moders = mysql_fetch_array($modersq))
- {
- echo($moders['username'].'[<a href="./?p=27&v=xhtml&sid='.$sid.'&mode=moder&m=0&id='.$moders['id'].'">Удалить</a>]<br />');
- }
- echo
- "</td>\r\n",
- "</tr>\r\n",
- "<tr>\r\n",
- "<td bgcolor=\"".$style['text']."\">\r\n",
- "<b><u>Добавить подфорум:</b></u><br />\r\n",
- "<form action=\"./?p=27&v=xhtml&mode=add&sid=".$sid."\" method=\"post\">\r\n",
- "Имя: <br />\r\n",
- "<input type=\"text\" name=\"name\" /><br />\r\n",
- "Позиция: <br /> \r\n",
- "<input type=\"text\" name=\"pos\" format=\"*N\" /><br />\r\n",
- "<input type=\"submit\" value=\"Добавить\" />\r\n",
- "</form>\r\n",
- "</td>\r\n</tr>\r\n",
- "<tr>\r\n",
- "<td bgcolor=\"".$style['text']."\">\r\n",
- "<b><u>Удалить подфорум:</b></u>\r\n",
- "</td>\r\n</tr>\r\n",
- "<tr>\r\n<td bgcolor=\"".$style['text']."\">\r\n",
- "<form action=\"./?p=27&v=xhtml&mode=del&sid=".$sid."\" method=\"post\">\r\n",
- "<select name=\"id\">\r\n";
- while($fnames = mysql_fetch_array($forums))
- {
- echo("<option value=\"".$fnames['id']."\">".$fnames['name']."</option>\r\n");
- }
- echo
- "</select><br />\r\n",
- "<input type=\"submit\" value=\"Удалить\" />\r\n",
- "</form>\r\n",
- "</td>\r\n</tr>\r\n",
- "<td bgcolor=\"".$style['text']."\">\r\n",
- "<b><u>Добавить модерский подфорум:</b></u><br />\r\n",
- "<form action=\"./?p=27&v=xhtml&mode=addm&sid=".$sid."\" method=\"post\">\r\n",
- "Имя: <br />\r\n",
- "<input type=\"text\" name=\"name\" /><br />\r\n",
- "Позиция: <br /> \r\n",
- "<input type=\"text\" name=\"pos\" format=\"*N\" /><br />\r\n",
- "<input type=\"submit\" value=\"Добавить\" />\r\n",
- "</form>\r\n",
- "</td>\r\n</tr>\r\n",
- "<tr>\r\n",
- "<td bgcolor=\"".$style['text']."\">\r\n",
- "<b><u>Удалить модерский подфорум:</b></u>\r\n",
- "</td>\r\n</tr>\r\n",
- "<tr>\r\n<td bgcolor=\"".$style['text']."\">\r\n",
- "<form action=\"./?p=27&v=xhtml&mode=delm&sid=".$sid."\" method=\"post\">\r\n",
- "<select name=\"id\">\r\n";
- while($fnamesm = mysql_fetch_array($mforums))
- {
- echo("<option value=\"".$fnamesm['id']."\">".$fnamesm['name']."</option>\r\n");
- }
- echo
- "</select><br />\r\n",
- "<input type=\"submit\" value=\"Удалить\" />\r\n",
- "</form>\r\n",
- "</td>\r\n</tr>\r\n",
- "<tr><td bgcolor=\"".$style['bottom']."\">\r\n",
- "<a href=\"./?p=0&v=xhtml&sid=".$sid."\">Форумы</a> \r\n",
- "</td>\r\n</tr>\r\n</table>\r\n",
- "</body></html>";
- }
- break;
- case 'del':
- mysql_query("DELETE posts.*
- FROM posts
- LEFT JOIN themes
- ON posts.id_theme=themes.id
- WHERE id_forum=".intval($_POST['id']));
- mysql_query("DELETE FROM `themes` WHERE `id_forum`=".intval($_POST['id']));
- mysql_query("DELETE FROM `forums` WHERE `id`=".intval($_POST['id']));
- header("Location: ".str_replace("?", "", $forumdir).'/?p=27&v='.$version.'&sid='.$sid);
- break;
- case 'delm':
- mysql_query("DELETE mposts.*
- FROM mposts
- LEFT JOIN mthemes
- ON mposts.id_theme=mthemes.id
- WHERE id_forum=".intval($_POST['id']));
- mysql_query("DELETE FROM `mthemes` WHERE `id_forum`=".intval($_POST['id']));
- mysql_query("DELETE FROM `mforums` WHERE `id`=".intval($_POST['id']));
- header("Location: ".str_replace("?", "", $forumdir).'/?p=27&v='.$version.'&sid='.$sid);
- break;
- case 'add':
- mysql_query("INSERT INTO `forums` VALUES(0, '".htmlspecialchars(sql($_POST['name']))."', ".intval($_POST['pos']).")");
- header("Location: ".str_replace("?", "", $forumdir).'/?p=27&v='.$version.'&sid='.$sid);
- break;
- case 'addm':
- mysql_query("INSERT INTO `mforums` VALUES(0, '".htmlspecialchars(sql($_POST['name']))."', ".intval($_POST['pos']).")");
- header("Location: ".str_replace("?", "", $forumdir).'/?p=27&v='.$version.'&sid='.$sid);
- break;
- case 'moder':
- if($_GET['m'] == "0")
- {
- mysql_query("UPDATE `users` SET `status`='user' WHERE `id`=".intval($_GET['id']));
- } else
- {
- mysql_query("UPDATE `users` SET `status`='moderator' WHERE `id`=".intval($_GET['id']));
- }
- header("Location: ".str_replace("?", "", $forumdir).'/?p=27&v='.$version.'&sid='.$sid);
- break;
-
-
- }
- }
- ?>
-
-