View file modules/kabinet/del_mes.php

File size: 3.09Kb
<?php
########################################
##	           WAP-ENGINE             ##
########################################
##                                    ##
##  Автор : CHUMA (Токарев Владимир)  ##
##  e-mail : [email protected]     ##
##  WAP : http://wap-engine.ru        ##
##                                    ##
########################################
##         ВЫ НЕ ИМЕЕТЕ ПРАВО         ##
##        ИЗМЕНЯТЬ КОД СКРИПТА        ##
##  ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ!  ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
####################
if(isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw)
 {
  if($_GET['box']=='outbox')
   {
    if($_GET['clear']==1)
     {
      write_to_file('../../data/outbox/'.$login.'.php', "<?php\r\n/*\r\n*/\r\n?>");
   
      header ("Location: outbox.php?&".session_name()."=".session_id()."");
     }
      else
     {
      $outbox_f = @file('../../data/outbox/'.$login.'.php');
      $outbox_count = count($outbox_f);
      for($i=2; $i < $outbox_count - 2; $i++)
       {
        $messages[] = $outbox_f[$i];
       }

      $mes_count = count($messages);

      for($i=0; $i < $mes_count; $i++)
       {
        if($i != $_GET['id'])
         {	
          $mes_to_file .= trim($messages[$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/outbox/'.$login.'.php', "<?php\r\n/*$mes_to_file\r\n*/\r\n?>");
   
      header ("Location: outbox.php?page=$_GET[page]&".session_name()."=".session_id()."");
     }
   }
    else
   {
    if($_GET['clear']==1)
     {
      write_to_file('../../data/inbox/'.$login.'.php', "<?php\r\n/*\r\n*/\r\n?>");
   
      header ("Location: inbox.php?&".session_name()."=".session_id()."");
     }
      else
     {
      $inbox_f = @file('../../data/inbox/'.$login.'.php');
      $inbox_count = count($inbox_f);
      for($i=2; $i < $inbox_count - 2; $i++)
       {
        $messages[] = $inbox_f[$i];
       }
      $mes_count = count($messages);

      for($i=0; $i < $mes_count; $i++)
       {
        if($i != $_GET['id'])
         {	
          $mes_to_file .= trim($messages[$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/inbox/'.$login.'.php', "<?php\r\n/*$mes_to_file\r\n*/\r\n?>");
   
      header ("Location: inbox.php?page=$_GET[page]&".session_name()."=".session_id()."");
     }
   }

 }
  else
 {
  include ("../../themes/$themes.php");
  echo"<p class=\"b\">Вы не авторизованы!!! Войдите в личный кабинет.<br /></p>";
  include ("../../templates/foot.php");
 }
?>