View file modules/kabinet/user_ban.php

File size: 8.96Kb
<?php
########################################
##	           WAP-ENGINE             ##
########################################
##                                    ##
##  Автор : CHUMA (Токарев Владимир)  ##
##  e-mail : [email protected]     ##
##  WAP : http://wap-engine.ru        ##
##                                    ##
########################################
##         ВЫ НЕ ИМЕЕТЕ ПРАВО         ##
##        ИЗМЕНЯТЬ КОД СКРИПТА        ##
##  ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ!  ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
$title_page ='Нарушения пользователя';
####################
$passw_in = $passw;
$login_in = $login;
$status_in = $status;

$time = date ("YmdHis", time() + ($sdvigclock*3600));
if (isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in)
 {
  include '../../themes/'.$themes.'.php';
if ($portal=='off')
 {
  echo'<p align="center">'.$offmes.'</p>';
 }
if ($portal=='on')
 {
$nick = filter($_GET['nick']);
  echo'<p class="modul_name"align="center">Нарушения пользователя '.$nick.'</p>';

$m_polozhenie = 'Смотрит нарушения пользователя '.$nick.'';

if($_GET['set'] == 1)
{
echo'<p class="b"><img src="/themes/chuma/es.gif"alt=""/> Нарушение удалено из базы.</p>';
}

  $users_f = file('../../data/users/'.$nick.'_ban.php');
if(!empty($users_f))
{
  array_splice($users_f, 0, 2);
  array_splice($users_f, -2, 2);
$users_count = count($users_f);
}
else
{
$users_count = 0;
}
  
  $users_on_f = file('../../data/user_online.txt');
  $user_on_arr = implode('|', $users_on_f);
  $kto = filter($_GET['kto']);

  $kols = $kolusers;
  
  
  for($ii = 0; $ii <= $users_count; $ii++)
   {
    $user_n = explode('|', $users_f[$ii]);
$data = $user_n['2'];
	  $users_arr[] = $users_f[$ii];
	 
   }
  $users_f = $users_arr;
  $stranic = ceil($users_count/$kols);

  if(!empty($kto))
   {
    for($ii = 0; $ii <= $users_count; $ii++)
     {
      $user_n = explode('|', $users_f[$ii]);
      if(stristr("$user_n[0]", "$kto"))
	   {
	    $users_arr2[] = $users_f[$ii];
	   }
     }
    $users_f = $users_arr2;
    
    $stranic = ceil($users_count/$kols);
   }


  if($users_count == 0)
   {
    echo'<p class="b">Нарушений у пользователя нет.</p>';
   }


  if(empty($_GET['page']))
   {
    $page_get = 1;
   }
    else
   {
    $page_get = $_GET['page'];
   }
  
  if($page_get > $stranic)
   {
    $page_get = $stranic;
   }
  if($page_get < 1)
   {
    $page_get = 1;
   }
   
  $do = $kols * ($page_get - 1);
  $end = $kols * $page_get;

  $page_nazad = $page_get - 1;
  $page_dalee = $page_get + 1;

  if (preg_match("#^[0-9]*$#", "$page_get")) 
   {
    for($i = $do; $i < $end; $i++)
     {
      $user_n = explode('|', $users_f[$i]);
	  if (!empty($users_f[$i]))
       {
	    echo'<p class="b">';
       
        if(strstr($user_on_arr, '|'.trim($user_n[0]).'|'))
         {
          }
          else
         {  
        }
user_data('../../data/users/'.trim($user_n[1]).'.php');
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = '<font color="'.$nickcolor.'">'.$nickname.'</font>';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$user_n[1].'';
}
        echo"Забанил: <a href=\"user_info.php?nick=$user_n[1]&amp;".session_name()."=".session_id()."\">$login_nick_color</a>";
if($icon_text == "1" || $icon_text == ""){
        echo" <a href=\"../kabinet/send_privat.php?nick=$user_n[1]&amp;".session_name()."=".session_id()."\"><img src=\"/images/st/1.gif\"align=\"top\"alt=\"\" title=\"Написать сообщение\"></a><br />";}if($icon_text == "0"){echo" <a href=\"../kabinet/send_privat.php?nick=$user_n[1]&amp;".session_name()."=".session_id()."\">[ЛС]</a><br />";}
        echo"За (что?): ".trim($user_n[3])."<br />";
if (!empty($users_f[$i]) && $user_n['2'] > $time)
{
echo"[<font color=\"red\">Бан активен</font>]";
if($status_in == "1" || $status_in == "2" || $status_in == "3")
   {
echo"[<a href=\"../admin/users.php?act=razban&amp;nick=$nick&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете разбан?')\">Разбанить</a>]";
echo"[<a href=\"user_ban.php?act=del&amp;nick=$nick&amp;id=$i&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете удаление?')\">Удалить</a>]<br />";
}
}
else
{
echo"[<font color=\"blue\">Бан неактивен</font>]";
if($status_in == "1" || $status_in == "2" || $status_in == "3")
   {
echo"[<a href=\"user_ban.php?act=del&amp;nick=$nick&amp;id=$i&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете удаление?')\">Удалить</a>]<br />";
}
}
	    echo'</p>';
       }
     }
   
    if($stranic > 1)
     {
      echo "<p align=\"center\" class=\"d\">";
      echo "Страницы:";
      echo "<br>";
      if($page_get > 4)
       {
        echo "<a href=\"user_ban.php?page=1&amp;nick=$lnick&amp;".session_name()."=".session_id()."\">1</a>...";
       }
 
      $start_1 = $page_get - 3;
      $end_1 = $page_get - 1;
      if($start_1 < 1)
       {
        $start_1 = 1;
       }
  
      for($i = $start_1; $i <= $end_1; $i++)
       {
        echo"<a href=\"user_ban.php?page=$i&amp;nick=$nick&amp;".session_name()."=".session_id()."\">$i</a> ";
       }

      echo"$page_get";

      $start_2 = $page_get + 1;
      $end_2 = $page_get + 3;
      if($start_2 < 1)
       {
        $start_2 = 1;
       }
      if($end_2 > $stranic)
       {
        $end_2 = $stranic;
       }
  
      for($i = $start_2; $i <= $end_2; $i++)
       {
        echo" <a href=\"user_ban.php?page=$i&amp;nick=$nick&amp;".session_name()."=".session_id()."\">$i</a>";
       }

      if($stranic > $page_get && $page_get < ($stranic-3))
       {
        echo "...<a href=\"user_ban.php?page=$stranic&amp;nick=$nick&amp;".session_name()."=".session_id()."\">$stranic</a>";
       }
      echo "<br>";


      if($page_get > 1)
       {
        echo "<a href=\"user_ban.php?page=$page_nazad&amp;nick=$nick&amp;".session_name()."=".session_id()."\">Назад</a>";
       }
      echo " | ";
      if($stranic > $page_get)
       {
        echo "<a href=\"user_ban.php?page=$page_dalee&amp;nick=$nick&amp;".session_name()."=".session_id()."\">Дальше</a>";
       } 
      echo "</p>";
     }
   }
    else
   {
    echo"<p align=\"center\">Неправельный формат страницы!!!<br>";
   }
  echo"<p>Всего нарушений: $users_count<br />";
echo"<a href=\"user_info.php?nick=$nick&amp;".session_name()."=".session_id()."\">Анкета $nick</a><br />";  
 echo"<a href=\"../kabinet/index.php?".session_name()."=".session_id()."\">В кабинет</a></p>";

###############

if($_GET['act'] == 'del')
{
if($status_in == "1" || $status_in == "2" || $status_in == "3")
{
$nick = filter($_GET['nick']);

$bans = @file('../../data/users/'.$nick.'_ban.php');
      $bans_count = count($bans);
      for($i=2; $i < $bans_count -2; $i++)
       {
        $banes[] = $bans[$i];
       }
      $bes_count = count($banes);

      for($i=0; $i < $bes_count; $i++)
       {
        if($i != $_GET['id'])
         {	
          $mes_to_file .= trim($banes[$i])."\r\n" ;
         }
       }
      $mes_to_file = trim($mes_to_file);
      if(!empty($mes_to_file))
       { $mes_to_file = "\r\n".$mes_to_file; } else
       { $mes_to_file = ''; }

      write_to_file('../../data/users/'.$nick.'_ban.php', "<?php\r\n/*$mes_to_file\r\n*/\r\n?>");


$date = date('d.m.Y / H:i:s', time() + ($sdvigclock*3600));
    $adm_log_f = @file('../../data/adm_log.php');
    $adm_log_count = count($adm_log_f) - 2;
    $mes_to_adm_log = "$login_in|$date|Удалил нарушение у пользователя $nick\r\n";
    for($i=2; $i < $adm_log_count; $i++)
     {
      $mes_to_adm_log .= $adm_log_f[$i];
     }
    $mes_to_adm_log = trim($mes_to_adm_log);
      
    $adm_log_file = fopen('../../data/adm_log.php','w');
    flock ($adm_log_file,LOCK_EX);
    fputs($adm_log_file,"<?php\r\n/*\r\n$mes_to_adm_log\r\n*/\r\n?>");
    fflush ($adm_log_file);
    flock ($adm_log_file,LOCK_UN);
    fclose($adm_log_file);

header ('Location: user_ban.php?nick='.$nick.'&set=1&'.session_name().'='.session_id().'');
}
}
}
  include '../../templates/foot.php';
 }
  else
 {
  include '../../themes/'.$themes.'.php';
if ($portal=='off')
 {
  echo'<p align="center">'.$offmes.'</p>';
 }
if ($portal=='on')
 {
  echo"<p class=\"b\">Вы не авторизованы!!! Войдите в личный кабинет.<br></p>";
  echo"<p><a href=\"../kabinet/index.php?".session_name()."=".session_id()."\">В кабинет</a><br></p>";
}
  include '../../templates/foot.php';
 }
####################
?>