View file modules/kabinet/copy_mes.php

File size: 2.32Kb
<?php
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
####################
if(isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw)
 {
  if($_GET['box']=='outbox')
   {
$id = filter($_GET['id']);
$f = file('../../data/outbox/'.$login.'.php');
$copybox_count = count($f);
$f2 = file('../../data/copybox/'.$login.'.php');
$copybox_count2 = count($f2);
if($copybox_count2 >= $kolmesls + 2)
     {
      header("Location: index.php?err=4&".session_name()."=".session_id()."");
     }
else
{
list($ms[0],$ms[1],$ms[2])=explode("|",$f[$id+2]);

    $adm_log_f = @file('../../data/copybox/'.$login.'.php');
    $adm_log_count = count($adm_log_f) - 2;

    $mes_to_adm_log = "$ms[0]|$ms[1]|$ms[2]|2\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/copybox/'.$login.'.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: index.php?set=out&".session_name()."=".session_id()."");
}

    }
if($_GET['box']=='inbox')
{
$id = filter($_GET['id']);
$f = file('../../data/inbox/'.$login.'.php');
$copybox_count = count($f);

$f2 = file('../../data/copybox/'.$login.'.php');
$copybox_count2 = count($f2);

if($copybox_count2 >= $kolmesls + 2)
     {
      header("Location: index.php?err=4&".session_name()."=".session_id()."");
     }
else
{
list($ms[0],$ms[1],$ms[2])=explode("|",$f[$id+2]);

    $adm_log_f = @file('../../data/copybox/'.$login.'.php');
    $adm_log_count = count($adm_log_f) - 2;
    $mes_to_adm_log = "$ms[0]|$ms[1]|$ms[2]|1\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/copybox/'.$login.'.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: index.php?set=in&".session_name()."=".session_id()."");
}
}
}
?>