Просмотр файла modules/chat/clear_chat.php

Размер файла: 2.67Kb
<?php
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
include ('../../themes/'.$themes.'.php');
##########
if (isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw && ($status == "1" || $status == "2"))
{

   	$basedel = '../../data/chat/1.txt';
 	$basestr = file($basedel);

 	$buff = "$basestr[0]$basestr[1]$basestr[2]$basestr[3]$basestr[4]";


    $file = fopen($basedel,'w');
    flock ($file,LOCK_EX);

    fputs($file,$buff);
    fflush ($file); 
    flock ($file,LOCK_UN);
    fclose($file);
 

$basesp = '../../data/chat/2.txt';

 	$basest = file($basesp);

 	$buf = "$basest[0]$basest[1]$basest[2]$basest[3]$basest[4]";
    $files = fopen($basesp,'w');

    flock ($files,LOCK_EX);
    fputs($files,$buf);
    fflush ($files); 
    flock ($files,LOCK_UN);

    fclose($files);

$basek = '../../data/chat/3.txt';
 	$bases = file($basek);
 	$bu = "$bases[0]$bases[1]$bases[2]$bases[3]$bases[4]";
    $filet = fopen($basek,'w');
    flock ($filet,LOCK_EX);
    fputs($filet,$bu);
    fflush ($filet); 
    flock ($filet,LOCK_UN);
    fclose($filet);


$basev = '../../data/chat/4.txt';
 	$basestrv = file($basev);
 	$buffv = "$basestrv[0]$basestrv[1]$basestrv[2]$basestrv[3]$basestrv[4]";
    $filev = fopen($basev,'w');
    flock ($filev,LOCK_EX);
    fputs($filev,$buffv);
    fflush ($filev); 
    flock ($filev,LOCK_UN);
    fclose($filev);



$basedelz = '../../data/chat/5.txt';
 	$basestrz = file($basedelz);
 	$buffz = "$basestrz[0]$basestrz[1]$basestrz[2]$basestrz[3]$basestrz[4]";
    $filez = fopen($basedelz,'w');
    flock ($filez,LOCK_EX);
    fputs($filez,$buffz);
    fflush ($filez); 
    flock ($filez,LOCK_UN);
    fclose($filez);


$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|Очистил все комнаты в чате\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: index.php?set=1&amp;".session_name()."=".session_id()."");
}
else
{
echo'<p class="err">Ошибка!!! Вы не авторизованы. Войдите в личный кабинет.</p>';
}

include ('../../templates/foot.php');
?>