View file forum/admin.php

File size: 34.29Kb
<?
session_start();
include ("header.php");
           if ($autorize['adminka']!=1) {
           echo $div["div"];
           echo "А ты уверен что ты админ!?<br/>-<br/>";
           echo $div["end"];
           include ("footer.php");
           exit();
           }
           $ref=rand(10000,10000000);
           if (empty($mod)) $mod="index";
           echo $div["header"];
           echo "Админка<br/>";
           echo $div["end"];
switch ($mod) {
     case "index":
           echo $div["div"];
           echo "Управление форумами:<br/>";
           echo "[<a href=\"admin.php?mod=addforum&amp;".session_name()."=".session_id()."\">Создать Форум</a>]<br/>";
           echo "[<a href=\"admin.php?mod=addpodforum&amp;".session_name()."=".session_id()."\">Создать Подфорум</a>]<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?mod=delforum&amp;".session_name()."=".session_id()."\">Удалить Форум</a>]<br/>";
           echo "[<a href=\"admin.php?mod=delpodforum&amp;".session_name()."=".session_id()."\">Удалить Подфорум</a>]<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?mod=redforum&amp;".session_name()."=".session_id()."\">Редактировать Форум</a>]<br/>";
           echo "[<a href=\"admin.php?mod=redpodforum&amp;".session_name()."=".session_id()."\">Редактировать Подфорум</a>]<br/>";
           echo "-<br/>";
           echo "Управление юзверьём:<br/>";
           echo $div["end"];
                      if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"admin.php?mod=edit&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "<input type=\"text\" name=\"user\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Пошел\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "Юзер: <br/>";
           echo "</small><input name=\"user\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Пошел<go href=\"admin.php?mod=edit&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"user\" value=\"$(user)\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           echo "-<br/>";
           echo "[<a href=\"admin.php?mod=spisokban&amp;".session_name()."=".session_id()."\">Список забаненных</a>]<br/>";
           echo "[<a href=\"admin.php?mod=spisokbanip&amp;".session_name()."=".session_id()."\">Список забаненных IP+SOFT</a>]<br/>";
           echo "[<a href=\"admin.php?mod=spisokdol&amp;".session_name()."=".session_id()."\">Список Админы\Модеры</a>]<br/>";
           echo "-<br/>";
           echo "[<a href=\"index.php?".session_name()."=".session_id()."\">Назад в форум</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
     break;
     case "addforum":
        if (empty($go)){
           echo $div["div"];
           echo "Форум: <br/>";
           echo $div["end"];
                      if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"admin.php?mod=addforum&amp;go=add&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "<input name=\"forum\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Создать\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "</small><input name=\"forum\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Создать<go href=\"admin.php?mod=addforum&amp;go=add&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"forum\" value=\"$(forum)\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
        }
        else
        {
           echo $div["div"];
           @mysql_query("insert into forum values(0,'$forum','','','1','','','','','','','');")or die ("FUCK");
           echo "Форум успешно создан!<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
        }
     break;
     case "addpodforum":
        if (empty($go)){
           $q = mysql_query("select * from forum where f='1' order by id;");
                                 if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"admin.php?mod=addpodforum&amp;go=add&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "Форумы:<br/>";
           echo "<select name=\"forumname\">";
           if (mysql_affected_rows()==0)
           {
           echo "Форумов нет!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $id=$field['id'];
           $forum=$field['forums'];
           echo "<option value=\"$forum\">$forum</option>";
           }
           }
           echo "</select><br/>";
           echo "-<br/>";
           echo "Подфорум<br/>";
           echo "<input name=\"podforum\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Создать\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "<u>Форумы:</u><br/>";
           echo "</small><select name=\"forumname\">";
           if (mysql_affected_rows()==0)
           {
           echo "Форумов нет!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $id=$field['id'];
           $forum=$field['forums'];
           echo "<option value=\"$forum\">$forum</option>";
           }
           }
           echo "</select><small><br/>";
           echo "-<br/>";
           echo "Подфорум<br/>";
           echo "</small><input name=\"podforum\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Создать<go href=\"admin.php?mod=addpodforum&amp;go=add&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"podforum\" value=\"$(podforum)\"/>";
           echo "<postfield name=\"forumname\" value=\"$(forumname)\"/>";
           echo "</go></anchor><br/>";
           }
           echo $div["div"];
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
        }
        else
        {
           echo $div["div"];
           @mysql_query("insert into forum values(0,'$forumname','$podforum','','','1','','','','','','');")or die ("FUCK");
           echo "ПодФорум успешно создан!<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
        }
     break;
     case "delforum":
        echo $div["div"];
        if (empty($go)){
           $q = mysql_query("select * from forum where f='1' order by id;");
           echo "Удалить Форум:<br/>";
           if (mysql_affected_rows()==0)
           {
           echo "Форумов нет!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $id=$field['id'];
           $forum=$field['forums'];
          echo "<a href=\"admin.php?mod=delforum&amp;go=del&amp;".session_name()."=".session_id()."&amp;forum=$forum\">$forum</a><br/>";
           }
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
        else
        {
           @mysql_query("delete from forum where forums='$forum'");
           echo "Форум успешно удален!<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
        echo $div["end"];
     break;
     case "delpodforum":
        echo $div["div"];
        if (empty($go)){
           $q = mysql_query("select * from forum where f='1' order by id;");
           echo "Форумы:<br/>";
           if (mysql_affected_rows()==0)
           {
           echo "Форумы не созданы!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $id=$field['id'];
           $forum=$field['forums'];
           echo "<a href=\"admin.php?mod=delpodforum&amp;".session_name()."=".session_id()."&amp;b=$id\">$forum</a><br/>";
           if ($b==$id)
           {
           $qp = mysql_query("select * from forum where ((b='1')and(forums='$forum')) order by id;");
           if (mysql_affected_rows()==0)
           {
           echo "Здесь пока пусто :( админ еще думает :)<br/>";
           }
           else
           {
           while ($pfield=mysql_fetch_array($qp))
           {
           $id=$pfield['id'];
           $pforum=$pfield['podforums'];
           echo "»<a href=\"admin.php?mod=delpodforum&amp;".session_name()."=".session_id()."&amp;go=del&amp;podforum=$pforum\">$pforum</a><br/>";
           }
           }

           }
           }
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
        else
        {
           @mysql_query("delete from forum where podforums='$podforum'");
           echo "ПодФорум успешно удален!<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
        echo $div["end"];
     break;
     case "redforum":
        echo $div["div"];
        if (empty($go)){
           $q = mysql_query("select * from forum where f='1' order by id;");
           echo "Редактировать форум:<br/>";
           if (mysql_affected_rows()==0)
           {
           echo "Форумов нет!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $id=$field['id'];
           $forum=$field['forums'];
          echo "<a href=\"admin.php?mod=redforum&amp;go=red&amp;".session_name()."=".session_id()."&amp;forumid=$forum\">$forum</a><br/>";
           }
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
        else if ($go=="red")
        {
           $q_msg = mysql_query("select * from `forum` where (`forums`='$forumid');");
           $row_msg=mysql_fetch_array($q_msg);
           $forum_db=$row_msg['forums'];
        if ($_SESSION['wap']=="xml")
           {
           $div["end"];
           echo "<form action=\"admin.php?mod=redforum&amp;go=ok&amp;".session_name()."=".session_id()."&amp;forumid=$forumid\" method=\"post\">";
           echo "<div>";
           echo "Форум: <br/>";
           echo "<input name=\"forum\" maxlength=\"250\" value=\"$forum_db\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           $div["div"];
           }
           else
           {
           echo "Форум: <br/>";
           echo "</small><input name=\"forum".$ref."\" value=\"$forum_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"admin.php?mod=redforum&amp;go=ok&amp;".session_name()."=".session_id()."&amp;forumid=$forumid\" method=\"post\">";
           echo "<postfield name=\"forum\" value=\"$(forum".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }
        }
        else
        {
           @mysql_query("UPDATE `forum` SET `forums`='$forum' WHERE `forums`='$forumid'");
           @mysql_query("UPDATE `messages` SET `forums`='$forum' WHERE `forums`='$forumid'");
           echo "Форум успешно изменен!<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
        echo $div["end"];
     break;
     case "redpodforum":
        echo $div["div"];
        if (empty($go)){
           $q = mysql_query("select * from forum where f='1' order by id;");
           echo "Форумы:<br/>";
           if (mysql_affected_rows()==0)
           {
           echo "Форумы не созданы!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $id=$field['id'];
           $forum=$field['forums'];
           echo "<a href=\"admin.php?mod=redpodforum&amp;".session_name()."=".session_id()."&amp;b=$id\">$forum</a><br/>";
           if ($b==$id)
           {
           $qp = mysql_query("select * from forum where ((b='1')and(forums='$forum')) order by id;");
           if (mysql_affected_rows()==0)
           {
           echo "Здесь пока пусто :( админ еще думает :)<br/>";
           }
           else
           {
           while ($pfield=mysql_fetch_array($qp))
           {
           $id=$pfield['id'];
           $pforum=$pfield['podforums'];
           echo "»<a href=\"admin.php?mod=redpodforum&amp;".session_name()."=".session_id()."&amp;go=red&amp;forumid=$pforum\">$pforum</a><br/>";
           }
           }

           }
           }
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
        else if ($go=="red")
        {
           $q_msg = mysql_query("select * from `forum` where (`podforums`='$forumid');");
           $row_msg=mysql_fetch_array($q_msg);
           $forum_db=$row_msg['podforums'];
        if ($_SESSION['wap']=="xml")
           {
           $div["end"];
           echo "<form action=\"admin.php?mod=redpodforum&amp;go=ok&amp;".session_name()."=".session_id()."&amp;forumid=$forumid\" method=\"post\">";
           echo "<div>";
           echo "ПодФорум: <br/>";
           echo "<input name=\"forum\" maxlength=\"250\" value=\"$forum_db\" title=\"Text\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Отправить\"/>";
           echo "</div>";
           echo "</form>";
           $div["div"];
           }
           else
           {
           echo "ПодФорум: <br/>";
           echo "</small><input name=\"forum".$ref."\" value=\"$forum_db\" maxlength=\"250\" title=\"Text\"/><br/><small>";
           echo "<anchor title=\"send\">Отправить<go href=\"admin.php?mod=redpodforum&amp;go=ok&amp;".session_name()."=".session_id()."&amp;forumid=$forumid\" method=\"post\">";
           echo "<postfield name=\"forum\" value=\"$(forum".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }
        }
        else
        {
           @mysql_query("UPDATE `forum` SET `podforums`='$forum' WHERE `podforums`='$forumid'");
           @mysql_query("UPDATE `messages` SET `podforums`='$forum' WHERE `podforums`='$forumid'");
           echo "ПодФорум успешно изменен!<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
        echo $div["end"];
     break;
     case "edit":
        if (empty($go)){
           $q = mysql_query("select * from `users` where `login`='$user';");
           if (mysql_affected_rows()==0)
           {
           echo $div["div"];
           echo "Нет такого!<br/>";
           echo $div["end"];
           }
           else
           {
           $row=mysql_fetch_array($q);
           $user_db= $row['login'];
           $pass_db= $row['pass'];
           $post= $row['posts'];
           $rating=$row['rating'];
           $status_db=$row['persst'];
           $moderka=$row['moderka'];
           $adminka=$row['adminka'];
           if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"admin.php?mod=edit&amp;go=ok&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "Юзер: <br/>";
           echo "<input name=\"user_db\" value=\"$user_db\"/><br/>";
           echo "Пароль: <br/>";
           echo "<input name=\"pass_db\" value=\"$pass_db\"/><br/>";
           echo "Посты: <br/>";
           echo "<input name=\"posts\" value=\"$post\"/><br/>";
           echo "Рейтинг: <br/>";
           echo "<input name=\"rating\" value=\"$rating\"/><br/>";
           echo "Статус: <br/>";
           echo "<input name=\"statusm\" value=\"$status_db\"/><br/>";
           echo "Должность: <br/>";
           if ($adminka==1) $moderka=3;
           echo "<select name=\"dol\">";
           echo "<option value=\"0\">Юзер</option>";
           echo "<option value=\"1\">Модер</option>";
           echo "<option value=\"2\">Ст.Модер</option>";
           echo "<option value=\"3\">Админ</option>";
           echo "</select><br/>";
           $q = mysql_query("select * from forum where f='1' order by id;");
           echo "Для форума:<br/>";
           echo "<select name=\"forumid\">";
           if (mysql_affected_rows()==0)
           {
           echo "Форумов нет!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $id=$field['id'];
           $forum=$field['forums'];
           echo "<option value=\"$id\">$forum</option>";
           }
           echo "<option value=\"all\">Глобально</option>";
           }
           echo "</select><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Изменить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "Юзер: <br/>";
           echo "</small><input name=\"user_db".$ref."\" value=\"$user_db\"/><br/><small>";
           echo "Пароль: <br/>";
           echo "</small><input name=\"pass_db".$ref."\" value=\"$pass_db\"/><br/><small>";
           echo "Посты: <br/>";
           echo "</small><input name=\"posts".$ref."\" value=\"$post\"/><br/><small>";
           echo "Рейтинг: <br/>";
           echo "</small><input name=\"rating".$ref."\" value=\"$rating\"/><br/><small>";
           echo "Статус: <br/>";
           echo "</small><input name=\"statusm".$ref."\" value=\"$status_db\"/><br/><small>";
                  echo "Должность: <br/>";
           if ($adminka==1) $moderka=3;
           echo "</small><select name=\"dol\">";
           echo "<option value=\"0\">Юзер</option>";
           echo "<option value=\"1\">Модер</option>";
           echo "<option value=\"2\">Ст.Модер</option>";
           echo "<option value=\"3\">Админ</option>";
           echo "</select><br/><small>";
           $q = mysql_query("select * from forum where f='1' order by id;");
           echo "Для форума:<br/>";
           echo "</small><select name=\"forumid\">";
           if (mysql_affected_rows()==0)
           {
           echo "Форумов нет!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $id=$field['id'];
           $forum=$field['forums'];
           echo "<option value=\"$id\">$forum</option>";
           }
           echo "<option value=\"all\">Глобально</option>";
           }
           echo "</select><br/><small>";
           echo "<anchor title=\"send\">Изменить<go href=\"admin.php?mod=edit&amp;go=ok&amp;user=$user&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"user_db\" value=\"$(user_db".$ref.")\"/>";
           echo "<postfield name=\"pass_db\" value=\"$(pass_db".$ref.")\"/>";
           echo "<postfield name=\"posts\" value=\"$(posts".$ref.")\"/>";
           echo "<postfield name=\"rating\" value=\"$(rating".$ref.")\"/>";
           echo "<postfield name=\"statusm\" value=\"$(statusm".$ref.")\"/>";
           echo "<postfield name=\"forumid\" value=\"$(forumid)\"/>";
           echo "<postfield name=\"dol\" value=\"$(dol)\"/>";
           echo "</go></anchor><br/>";
           }
           }
           echo $div["div"];
           echo "-<br/>";
           echo "[<a href=\"admin.php?mod=deluser&amp;user=$user&amp;".session_name()."=".session_id()."\">Удалить юзера</a>]<br/>";
           echo "[<a href=\"admin.php?mod=ban&amp;user=$user&amp;".session_name()."=".session_id()."\">Забанить юзера</a> /";
           echo " <a href=\"admin.php?mod=razban&amp;user=$user&amp;".session_name()."=".session_id()."\">Разбанить</a>]<br/>";
           echo "[<a href=\"admin.php?mod=banwhy&amp;user=$user&amp;".session_name()."=".session_id()."\">Бан(причина, время)</a>]<br/>";
           echo "[<a href=\"admin.php?mod=banip&amp;user=$user&amp;".session_name()."=".session_id()."\">Бан по IP+SOFT</a>]<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
        }
        else
        {
           @mysql_query("UPDATE users SET `login`='$user_db',`pass`='$pass_db',`posts`='$posts',`rating`='$rating',`persst`='$statusm' WHERE `login`='$user_db'");
           if ($dol=="0")
           {
           @mysql_query("delete from `moders` WHERE `who`='$user_db';");
           @mysql_query("UPDATE users SET `moderka`='0',`adminka`='0',`group`='Юзеры' WHERE `login`='$user_db'");
           }
           if ($dol=="1")
           {
           @mysql_query("insert into moders values(0,'$user_db','$forumid');");
           @mysql_query("UPDATE users SET `moderka`='1',`group`='Модеры' WHERE `login`='$user_db'");
           }
           if ($dol=="2")
           {
           @mysql_query("insert into moders values(0,'$user_db','$forumid');");
           @mysql_query("UPDATE users SET `moderka`='2',`group`='Ст.Модеры' WHERE `login`='$user_db'");
           }
           if ($dol=="3")
           {
           @mysql_query("UPDATE users SET `adminka`='1',`group`='Админы' WHERE `login`='$user_db'");
           }
           echo "Готово!<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
        }
     break;
     case "deluser":
     echo $div["div"];
     $q = mysql_query("select * from `users` where `login`='$user';");
           if (mysql_affected_rows()==0)
           {
           echo "Нет такого!<br/>";
           }
           else
           {
           @mysql_query("delete from users where `login`='$user'");
           echo "$user, Удален!<br/>";
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
     echo $div["end"];
     break;
          case "banwhy":
          if (empty($go)){
                      if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"admin.php?mod=banwhy&amp;go=ok&amp;user=$user&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "Причина: <br/>";
           echo "<input name=\"why\"/><br/>";
           echo "Время(минуты): <br/>";
           echo "<input name=\"kick\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"В баню\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "Причина: <br/>";
           echo "</small><input name=\"why".$ref."\"/><br/><small>";
           echo "Время(минуты): <br/>";
           echo "</small><input name=\"kick".$ref."\"/><br/><small>";
           echo "<anchor title=\"send\">В баню<go href=\"admin.php?mod=banwhy&amp;go=ok&amp;user=$user&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"why\" value=\"$(why".$ref.")\"/>";
           echo "<postfield name=\"kick\" value=\"$(kick".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }
          }else{
          	echo $div["div"];
            $q = mysql_query("select * from `users` where `login`='$user';");
           if (mysql_affected_rows()==0)
           {
           echo "Нет такого!<br/>";
           }
           else
           {
           $timenow=date("YmdHi");
           $newtimenow=$timenow+$kick;
           //@mysql_query("delete from `messages` where `who`='$user'");
           @mysql_query("UPDATE users SET `kick`='$newtimenow',`why`='$why' WHERE `login`='$user'");
           echo "$user, забанен!<br/>";
           echo $div["end"];
           }
           }
           echo $div["div"];
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
     break;
     case "ban":
     echo $div["div"];
     $q = mysql_query("select * from `users` where `login`='$user';");
           if (mysql_affected_rows()==0)
           {
           echo "Нет такого!<br/>";
           }
           else
           {
           //@mysql_query("delete from `messages` where `who`='$user'");
           @mysql_query("UPDATE users SET `ban`='1' WHERE `login`='$user'");
           echo "$user, забанен!<br/>";
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
     echo $div["end"];
     break;
     case "razban":
     echo $div["div"];
     $q = mysql_query("select * from `users` where `login`='$user';");
           if (mysql_affected_rows()==0)
           {
           echo "Нет такого!<br/>";
           }
           else
           {
           @mysql_query("UPDATE users SET `ban`='0' WHERE `login`='$user'");
           echo "$user, разбанен!<br/>";
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
     echo $div["end"];
     break;
     case "razbanip":
     echo $div["div"];
           @mysql_query("delete from ban where ((ip='$ip')and(brow='$brow'));");
           echo "$ip : $brow, разбанен!<br/>";
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
     echo $div["end"];
     break;
          case "banip":
          echo $div["div"];
           $q = mysql_query("select * from `users` where `login`='$user';");
           if (mysql_affected_rows()==0)
           {
           echo "Нет такого!<br/>";
           }
           else
           {
           $row=mysql_fetch_array($q);
           $ip_db= $row['ip'];
           $brow_db= $row['brow'];
           @mysql_query("insert into ban values(0,'$ip_db','$brow_db');");
           //@mysql_query("delete from `messages` where `who`='$user'");
           echo "$ip_db:$brow_db добавлены в черный список!<br/>";
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
     break;

     case "spisokban":
     echo $div["div"];
           $q = mysql_query("select * from `users` where `ban`='1';");
           if (mysql_affected_rows()==0)
           {
           echo "Список пуст!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $user_db=$field['login'];
           echo "$user_db";
           echo "[<a href=\"admin.php?mod=razban&amp;user=$user_db&amp;".session_name()."=".session_id()."\">Разбан</a>]<br/>";
           }
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
     echo $div["end"];
     break;
     case "spisokbanip":
     echo $div["div"];
           $q = mysql_query("select * from `ban`;");
           if (mysql_affected_rows()==0)
           {
           echo "Список пуст!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $ip_db=$field['ip'];
           $brow_db=$field['brow'];
           echo "$ip_db : $brow_db";
           echo "[<a href=\"admin.php?mod=razbanip&amp;ip=$ip_db&amp;brow=$brow_db&amp;".session_name()."=".session_id()."\">Разбан</a>]<br/>";
           }
           }
           echo "-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
     echo $div["end"];
     break;
          case "spisokdol":
     echo $div["div"];
           if (!empty($delf))
           {
           @mysql_query("delete from moders where id='$delf'");
           }
           if (!empty($dol))
           {
           @mysql_query("delete from `moders` WHERE `who`='$user_db';");
           @mysql_query("UPDATE users SET `moderka`='0',`adminka`='0',`group`='Юзеры' WHERE `login`='$user_db'");
           }
           $q = mysql_query("select * from `users` where `adminka`='1';");
           echo "Админы<br/>";
           if (mysql_affected_rows()==0)
           {
           echo "Список пуст! Парадокс!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $user=$field['login'];
           echo "<b>$user</b> [<a href=\"admin.php?mod=spisokdol&amp;user_db=$user&amp;dol=ok&amp;".session_name()."=".session_id()."\">Снять</a>]<br/>";
           }
           }
           echo "-<br/>";
           $q = mysql_query("select * from `users` where `moderka`='1';");
           echo "Модеры";
           if (mysql_affected_rows()==0)
           {
           echo "<br/>Список пуст!";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $user=$field['login'];
           echo "<br/><b>$user</b> [<a href=\"admin.php?mod=spisokdol&amp;user_db=$user&amp;dol=ok&amp;".session_name()."=".session_id()."\">Снять</a>]";
           $qm = mysql_query("select * from `moders` where `who`='$user';");
           if (mysql_affected_rows()==0)
           {
           echo "<br/>Список пуст!";
           }
           else
           {
           while ($fieldm=mysql_fetch_array($qm))
           {
           $idf=$fieldm['id'];
           $forum=$fieldm['forum'];
           if ($forum!="all")
           {
           $qmf = mysql_query("select * from `forum` where `id`='$forum';");
           $fieldmf=mysql_fetch_array($qmf);
           $id=$fieldmf['id'];
           $forums=$fieldmf['forums'];
           echo "<br/>";
           echo $forums;
           echo " [<a href=\"admin.php?mod=spisokdol&amp;delf=$idf&amp;".session_name()."=".session_id()."\">-</a>]";
           }
           else
           {
           echo " Глобальный";
           }
           }
           }
           }
           }
           echo "<br/>-<br/>";
           $q = mysql_query("select * from `users` where `moderka`='2';");
           echo "Ст. Модеры";
           if (mysql_affected_rows()==0)
           {
           echo "<br/>Список пуст!<br/>";
           }
           else
           {
           while ($field=mysql_fetch_array($q))
           {
           $user=$field['login'];
           echo "<br/><b>$user</b> [<a href=\"admin.php?mod=spisokdol&amp;user_db=$user&amp;dol=ok&amp;".session_name()."=".session_id()."\">Снять</a>]";
           $qm = mysql_query("select * from `moders` where `who`='$user';");
           if (mysql_affected_rows()==0)
           {
           echo "<br/>Список пуст!";
           }
           else
           {
           while ($fieldm=mysql_fetch_array($qm))
           {
           $idf=$fieldm['id'];
           $forum=$fieldm['forum'];
           if ($forum!="all")
           {
           $qmf = mysql_query("select * from `forum` where `id`='$forum';");
           $fieldmf=mysql_fetch_array($qmf);
           $id=$fieldmf['id'];
           $forums=$fieldmf['forums'];
           echo "<br/>";
           echo $forums;
           echo " [<a href=\"admin.php?mod=spisokdol&amp;delf=$idf&amp;".session_name()."=".session_id()."\">-</a>]";
           }
           else
           {
           echo " Глобальный";
           }
           }
           }
           }
           }
           echo "<br/>-<br/>";
           echo "[<a href=\"admin.php?".session_name()."=".session_id()."\">Админка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
     break;
     case "2":

     break;
           }
include ("footer.php");
?>