View file modules/admin/complaint_msg.php

File size: 8.05Kb
<?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 ='Список жалоб &#187; Почта';
$m_polozhenie = 'В админ панели';
####################
if (isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw && ($status == "1" || $status == "2" || $status == "3"))
 {
  include '../../themes/'.$themes.'.php';
  echo'<p class="modul_name"align="center"><a href="complaints.php">Список жалоб</a> &#187; Почта</p>';
if($_GET['set'] == 1)
{
echo'<p class="b"><img src="/themes/chuma/es.gif"alt=""/> Жалоба удалена из базы.</p>';
}

  $users_f = file('../../data/complaints/msg.php');
  array_splice($users_f, 0, 2);
  array_splice($users_f, -2, 2);
  
  $users_on_f = file('../../data/user_online.txt');
  $user_on_arr = implode('|', $users_on_f);
  $kto = filter($_GET['kto']);

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

  
  if($users_count == 0 && empty($kto))
   {
    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">';
        echo"Жалоба от: <a href=\"users.php?act=edit&amp;nick=$user_n[0]&amp;".session_name()."=".session_id()."\">".trim($user_n[0])."</a>";if($icon_text == "1" || $icon_text == ""){
	    echo" <a href=\"../kabinet/send_privat.php?nick=$user_n[0]&amp;".session_name()."=".session_id()."\"><img src=\"/images/st/1.gif\"align=\"top\"alt=\"\"title=\"Написать сообщение\"></a>";}if($icon_text == "0"){echo" <a href=\"../kabinet/send_privat.php?nick=$user_n[0]&amp;".session_name()."=".session_id()."\">[ЛС]</a>";}
        if(strstr($user_on_arr, '|'.trim($user_n[0]).'|'))
         {
          echo" <span style='background-color:#00AA00; color:#fff; padding-left:2px; padding-right:2px;'><b>ON</b></span><br />";
         }
          else
         {
          echo" <span style='background-color:#f30; color:#fff; padding-left:2px; padding-right:2px;'><b>OFF</b></span><br />";
         }
echo"(".trim($user_n[1]).")<br />";
echo"Причина:<br />".trim($user_n[2])."<br />";

        echo"<br />От кого: <a href=\"users.php?act=edit&amp;nick=$user_n[3]&amp;".session_name()."=".session_id()."\">".trim($user_n[3])."</a>";if($icon_text == "1" || $icon_text == ""){
        echo" <a href=\"../kabinet/send_privat.php?nick=$user_n[3]&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[3]&amp;".session_name()."=".session_id()."\">[ЛС]</a><br />";}
        echo"Отправлено:<br />".trim($user_n[4])."<br />Сообщение:<br />".trim($user_n[5])."<br />";
echo"[<a href=\"complaint_msg.php?act=del&amp;nick=$user_n[0]&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=\"complaint_msg.php?page=1&amp;kto=$kto&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=\"complaint_msg.php?page=$i&amp;kto=$kto&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=\"complaint_msg.php?page=$i&amp;kto=$kto&amp;".session_name()."=".session_id()."\">$i</a>";
       }

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

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

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

if($_GET['act'] == 'del')
{

$bans = @file('../../data/complaints/msg.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/complaints/msg.php', "<?php\r\n/*$mes_to_file\r\n*/\r\n?>");

$nick = $_GET['nick'];

$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|$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: complaint_msg.php?set=1&'.session_name().'='.session_id().'');
}
  include '../../templates/foot.php';
 }
  else
 {
  include '../../themes/'.$themes.'.php';
  echo"<p class=\"err\">Вы не авторизованы!!! Войдите в личный кабинет.<br></p>";
  echo"<p><a href=\"../kabinet/index.php?".session_name()."=".session_id()."\">В кабинет</a><br></p>";
  include '../../templates/foot.php';
 }
####################
?>