View file load/main/news_add.php

File size: 1.77Kb
<?php
/*
Автор: Evgenij made in AZOV 
E-mail: [email protected] (Всем вопросы и тех. поддержка)
Запрещенно!!: добавлять данный скрипт в бесплатные архивы!!, продавать!!, Меняться на форумах и т.д и т.п!!, без моего согласия:) 
*/

include "cfg.php";
$substr_count = substr_count($dirr,"$Obmennik");
if(($substr_count!=0)&&($substr_count!="")) {$this_file=$this_file_obmennik;} 
$date=date("d.m.y");
$time=date("H:i"); 
$str=strlen($msg);
if($msg=="" || $str<1){
header ("Location: news.php?filename=$filename$endif&dirr=$dirr&style=$style&ver=$ver"); exit;}
$msg=wordwrap($msg,40,' ',1);
$brow=str_replace("|"," ",$brow);
$brow=htmlspecialchars(stripslashes($brow));
$msg=substr($msg,0,1000);
$msg=stripslashes($msg);
$msg=htmlspecialchars($msg);
$msg=str_replace("|"," ",$msg);
$name=stripslashes($name);
$name=htmlspecialchars($name);
$name=str_replace("|"," ",$name);
$msg=str_replace("$","&#036;",$msg);
$msg=str_replace("\\","",$msg);
$file = @file("news/$filename.dat");
$total = count($file);
$total = $total - 1;
$data1 = explode("|",$file[$total]);
$me=$data1[5]+1;
$text=$brow.' - '.$me.'|'.$msg.'|'.$date.'|'.$time.'|'.$name.'|'.$me.'|';
$text=str_replace("\r\n", "", $text);
$fp=fopen("news/$filename.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
flock ($fp,LOCK_UN);
fclose($fp);
//@chmod("$fp", 0666);
$file=file("news/$filename.dat"); $i = count($file);
if ($i>=$maxmeschat) {
$fp=fopen("news/$filename.dat","+a");
flock ($fp,LOCK_EX);
unset($file[0]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);}
header ("Location: news.php?filename=$filename$endif&dirr=$dirr&style=$style&ver=$ver");
?>