View file forum/moder.php

File size: 12.41Kb
<?
session_start();
include ("header.php");
           if ($autorize['moderka']<1) {echo "А ты уверен что ты модер!?<br/>-<br/>";
           include ("footer.php");
           exit();
           }
           $ref=rand(10000,10000000);
           if (empty($mod)) $mod="index";
switch ($mod) {
     case "index":
           echo $div["div"];
           echo "Управление юзверьём:<br/>";
           echo $div["end"];
                      if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"moder.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=\"moder.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=\"moder.php?mod=spisokban&amp;".session_name()."=".session_id()."\">Список забаненных</a>]<br/>";
           if ($autorize['moderka']==2) echo "[<a href=\"moder.php?mod=spisokbanip&amp;".session_name()."=".session_id()."\">Список забаненных IP+SOFT</a>]<br/>";
           echo "-<br/>";
           echo "[<a href=\"index.php?".session_name()."=".session_id()."\">Назад в форум</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
     break;

     case "edit":

           if ($autorize['moderka']!=2) {
           	echo $div["div"];
           echo "Доступ закрыт!<br/>-<br/>";
           echo $div["end"];
           include ("footer.php");
           exit();
           }
        if (empty($go)){
           $q = mysql_query("select * from `users` where `login`='$user';");
           $row=mysql_fetch_array($q);
           $admin=$row['adminka'];
           if ($admin==1) {
           echo $div["div"];
           echo "Ты ли не охуел прыгать на админа??<br/>-<br/>";
           echo $div["end"];
           include ("footer.php");
           exit();
           }
           if (mysql_affected_rows()==0)
           {
           echo $div["div"];
           echo "Нет такого!<br/>";
           echo $div["end"];
           }
           else
           {
           $row=mysql_fetch_array($q);
           $status=$row['persst'];
                      if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"moder.php?mod=edit&amp;go=ok&amp;user=$user&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<div>";
           echo "Статус: <br/>";
           echo "<input name=\"status\" value=\"$status\"/><br/>";
           echo "<input class=\"ibutton\" type=\"submit\" value=\"Изменить\"/>";
           echo "</div>";
           echo "</form>";
           }
           else
           {
           echo "Статус: <br/>";
           echo "</small><input name=\"status".$ref."\" value=\"$status\"/><br/><small>";
           echo "<anchor title=\"send\">Изменить<go href=\"moder.php?mod=edit&amp;go=ok&amp;user=$user&amp;".session_name()."=".session_id()."\" method=\"post\">";
           echo "<postfield name=\"status\" value=\"$(status".$ref.")\"/>";
           echo "</go></anchor><br/>";
           }
           }
           echo $div["div"];
           echo "-<br/>";
           echo "[<a href=\"moder.php?mod=ban&amp;user=$user&amp;".session_name()."=".session_id()."\">Забанить юзера</a> /";
           echo " <a href=\"moder.php?mod=razban&amp;user=$user&amp;".session_name()."=".session_id()."\">Разбанить</a>]<br/>";
           echo "[<a href=\"moder.php?mod=banwhy&amp;user=$user&amp;".session_name()."=".session_id()."\">Бан(причина, время)</a>]<br/>";
           if ($autorize['moderka']==2) echo "[<a href=\"moder.php?mod=banip&amp;user=$user&amp;".session_name()."=".session_id()."\">Бан по IP+SOFT</a>]<br/>";
           echo "-<br/>";
           echo "[<a href=\"moder.php?".session_name()."=".session_id()."\">Модерка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
        }
        else
        {
           echo $div["div"];
           @mysql_query("UPDATE users SET `persst`='$status' WHERE `login`='$user'");
           echo "Готово!<br/>";
           echo "-<br/>";
           echo "[<a href=\"moder.php?".session_name()."=".session_id()."\">Модерка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
        }
     break;
          case "banwhy":
          $row=mysql_fetch_array($q);
           $admin=$row['adminka'];
           if ($admin==1) {
           	echo $div["div"];
           echo "Ты ли не охуел банить админа?<br/>-<br/>";
           echo $div["end"];
           include ("footer.php");
           exit();
           }
          if (empty($go)){
                      if ($_SESSION['wap']=="xml")
           {
           echo "<form action=\"moder.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=\"moder.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=\"moder.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';");
     $row=mysql_fetch_array($q);
     $admin=$row['adminka'];
           if ($admin==1) {echo "Ты ли не охуел банить админа?<br/>-<br/>";
           include ("footer.php");
           exit();
           }
           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=\"moder.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=\"moder.php?".session_name()."=".session_id()."\">Модерка</a>]<br/>";
           echo "-<br/>";
     echo $div["end"];
     break;

     case "spisokban":
     echo $div["div"];
           if ($autorize['moderka']!=2) {echo "Доступ закрыт!<br/>-<br/>";
           include ("footer.php");
           exit();
           }
           $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=\"moder.php?mod=razban&amp;user=$user_db&amp;".session_name()."=".session_id()."\">Разбан</a>]<br/>";
           }
           }
           echo "-<br/>";
           echo "[<a href=\"moder.php?".session_name()."=".session_id()."\">Модерка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
     break;
     case "spisokbanip":
           if ($autorize['moderka']!=2) {
           echo $div["div"];
           echo "Доступ закрыт!<br/>-<br/>";
           echo $div["end"];
           include ("footer.php");
           exit();
           }
           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=\"moder.php?mod=razbanip&amp;ip=$ip_db&amp;brow=$brow_db&amp;".session_name()."=".session_id()."\">Разбан</a>]<br/>";
           }
           }
           echo "-<br/>";
           echo "[<a href=\"moder.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=\"moder.php?".session_name()."=".session_id()."\">Модерка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
     break;
          case "banip":
           $q = mysql_query("select * from `users` where `login`='$user';");
           $row=mysql_fetch_array($q);
           $admin=$row['adminka'];
           if ($admin==1) {
           echo $div["div"];
           echo "Ты ли не охуел банить админа?<br/>-<br/>";
           echo $div["end"];
           include ("footer.php");
           exit();
           }
           if (mysql_affected_rows()==0)
           {
           echo $div["div"];
           echo "Нет такого!<br/>";
           echo $div["end"];
           }
           else
           {
           echo $div["div"];
           $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 $div["end"];
           }
           echo $div["div"];
           echo "-<br/>";
           echo "[<a href=\"moder.php?".session_name()."=".session_id()."\">Модерка</a>]<br/>";
           echo "-<br/>";
           echo $div["end"];
     break;
           }
include ("footer.php");
?>