<?php
// автор скрипта - Arab
// icq - 9988817 сайт: http://bola.net.ru
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
include_once "includ/functions.php";
include_once "includ/login.php";
include_once "includ/setting.php";
include_once "includ/online.php";
$ver=full_check($ver);
$ip=check($_SERVER['REMOTE_ADDR']);
if (!$_SESSION[login]=="" && !md5($_SESSION[password])=="" && md5($_SESSION[password])==$npassword && $_SESSION[login]==$nlogin){
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////// ДОБАВЛЕНИЕ сооббщения //////////////////////////////////////////////////////////////
if(isset($addmsg)){
$addmsg=full_check($addmsg);
if (isset($_POST['msg'])) $msg=($_POST['msg']);
if (isset($_POST['id'])) $id=check($_POST['id']);
if (isset($_POST['tems'])) $tems=check($_POST['tems']);
if (isset($_POST['strok'])) $strok=check($_POST['strok']);
$checkop = @file("$maindir/forum/data/forum/".check($id).".tem");
$chek = explode("|",$checkop[0]);
if($chek[9]=="closed"){
include_once "../css/red/index.php";
echo'<center><font color="#dd1111"><b>Нельзя писать в закрытую тему!</b></font></center>';
include_once "../css/red/foot.php"; exit;}
if($day_chas<=8 && $day_chas>=1){
$msg_time=time()-70;
if($m_antiflood>$msg_time){
include_once "../css/red/index.php";
echo'<p align="center"><br><b>Ночной сторож: нельзя добавлять сообщения чаще чем в каждые 70сек!</b></p>';
include_once "../css/red/foot.php"; exit;}}
$msg_time=time()-$conf_antiflood;
if($m_antiflood>$msg_time){
include_once "../css/red/index.php";
echo'<p align="center"><br><b>Анти-флуд: нельзя добавлять сообщения слишком часто!</b></p>';
include_once "../css/red/foot.php"; exit;}
if(empty($msg)){
include_once "../css/red/index.php";
echo'<p align="center"><b>Забыли написать сообщение</b></p>';
include_once "../css/red/foot.php"; exit;}
if(win_to_utf(strlen(utf_to_win($msg)))<3 || win_to_utf(strlen(utf_to_win($msg)))>2000){
include_once "../css/red/index.php";
echo'<p align="center"><b>Сообщение слишком короткое или длинное</b></p>';
include_once "../css/red/foot.php"; exit;}
$msg=check($msg);
if(!file_exists(''.$maindir.'/forum/data/forum/'.$id.'.tem')){
include_once "../css/red/index.php";
echo'<center>Такой темы не существует!</center>';
include_once "../css/red/foot.php"; exit;}
if(!is_numeric($id)){
include_once "../css/red/index.php";
echo'Пошел нах!'; include_once "../css/red/foot.php"; exit;}
if(!is_numeric($tems)){
include_once "../css/red/index.php";
echo'Пошел нах!'; include_once "../css/red/foot.php"; exit;}
if(!file_exists(''.$maindir.'/forum/data/forum/razd'.$tems.'.dat')){
include_once "../css/red/index.php";
echo'<center>Такого раздела не существует!</center>';
include_once "../css/red/foot.php"; exit;}
///////////////////////////////////////// проверка на мат. если есть мат то юзер летит в баню
if($m_level=="4"){
$msg=antimat($msg);
if(eregi("W4d66R6T89ывnы7UвrаV3мKfD",$msg)){
$povod = "мат на форуме";
$realtime = time();
$vremya = check($realtime+$conf_avtobantime);
$allban = check($m_allban+1);
$text=$udata[0].'|'.$udata[1].'|'.$udata[2].'|'.$udata[3].'|'.$udata[4].'|'.$udata[5].'|'.$udata[6].'|'.$data[7].'|'.$udata[8].'|'.$udata[9].'|'.$udata[10].'|'.$udata[11].'|'.$udata[12].'|'.$udata[13].'|'.$udata[14].'|'.$udata[15].'|'.$udata[16].'|'.$udata[17].'|'.$vremya.'|'.$povod.'|'.$udata[20].'|'.$udata[21].'|'.$allban.'|'.$udata[23].'|'.$udata[24].'|'.$udata[25].'|'.$udata[26].'|'.$udata[27].'|'.$udata[28].'|'.time().'|';
$text=str_replace("\r\n", "", $text);
$fp=fopen(''.check($maindir).'/forum/data/users/'.check($login.log).'','r+');
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,"$text");
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
chmod (''.check($maindir).'/forum/data/users/'.check($login).'.log', 0666);
if($m_allban>"$conf_allbans"){ @unlink("$maindir/forum/data/users/$login.log"); @unlink("$maindir/forum/data/privat/$login.dat"); }
$msgtime = check(date("G:i/j F"));
$data = check(date("j.n.y"));
$time = check(date("G:i"));
$textmsg=$tems.'|'.$temname[1].'|Система|'.$temname[3].'|'.$id.'|Пользователь <b>'.$login.'</b> забанен за мат!|'.$time.'|'.$data.'|'.$ip.'|'.$temname[9].'|';
$textmsg=str_replace("\r\n", "", $textmsg);
$fp=fopen("$maindir/forum/data/forum/".check($id).".tem","a+");
flock($fp,LOCK_EX);
fputs($fp,"$textmsg\r\n");
flock($fp,LOCK_UN);
fclose($fp);
chmod ("$maindir/forum/data/forum/$id.tem", 0666);
if($ver=="web"){ header ("Location: web.php?".SID); }else{
header ("Location: index.php?".SID); } exit; }}
$data = check(date("j.n.y"));
$time = check(date("G:i"));
$fx = file("$maindir/forum/data/mainforum.dat");
$other = explode("|",$fx[$tems]);
$f = file("$maindir/forum/data/forum/".check($id).".tem");
$temname = explode("|",$f[0]);
$txttem=$tems.'|'.$temname[1].'|'.$login.'|'.$temname[3].'|'.$id.'|'.$msg.'|'.$time.'|'.$data.'|'.$ip.'|'.$temname[9].'|';
$txttem=str_replace("\r\n", "", $txttem); ///// ТЕМА
$fp=fopen("$maindir/forum/data/forum/".check($id).".tem","a+");
fputs($fp,"$txttem\r\n");
fclose($fp);
$plusmsg=$other[3]+1;
$fx[$tems]="$other[0]|$other[1]|$other[2]|$plusmsg|$login|$temname[3]|$time|$data|$id|\r\n";
$rezultat=implode("",$fx);
$fp=fopen("$maindir/forum/data/mainforum.dat","w");
fputs($fp,$rezultat);
$fff = file("$maindir/forum/data/users/$login.log"); // +1 балл
$udata = explode("|",$fff[0]);
$ballplus=$udata[20]+1;
$forumplus=$udata[21]+1;
$text=$udata[0].'|'.$udata[1].'|'.$udata[2].'|'.$udata[3].'|'.$udata[4].'|'.$udata[5].'|'.$udata[6].'|'.$data[7].'|'.$udata[8].'|'.$udata[9].'|'.$udata[10].'|'.$udata[11].'|'.$udata[12].'|'.$udata[13].'|'.$udata[14].'|'.$udata[15].'|'.$udata[16].'|'.$udata[17].'|'.$udata[18].'|'.$udata[19].'|'.$ballplus.'|'.$forumplus.'|'.$udata[22].'|'.$udata[23].'|'.$udata[24].'|'.$udata[25].'|'.$udata[26].'|'.$udata[27].'|'.$udata[28].'|'.time().'|';
$text=str_replace("\r\n", "", $text);
$fp=fopen("$maindir/forum/data/users/$login.log","r+");
fputs($fp,"$text");
fclose($fp);
if($ver=="web"){ header ("Location: web.php?addmsg&messages&tem=$tems&id=$id&".SID); }else{
header ("Location: index.php?addmsg&messages&tem=$tems&id=$id&".SID);} exit;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////// ДОБАВЛЕНИЕ ТЕМЫ /////////////////////////////////////////////////////////////////
if(isset($newtema)){
$newtema=full_check($newtema);
if (isset($_POST['razdel'])) $razdel = full_check($_POST['razdel']);
if(!is_numeric($razdel)){ echo'Пошел нах!'; exit; }
if (isset($_POST['msg'])) $msg=($_POST['msg']);
if (isset($_POST['temname'])) $temname=($_POST['temname']);
if($day_chas<=8 && $day_chas>=1){
$msg_time=time()-70;
if($m_antiflood>$msg_time){
include_once "../css/red/index.php";
echo'<p align="center"><br><b>Ночной сторож: нельзя добавлять сообщения чаще чем в каждые 70сек!</b></p>';
include_once "../css/red/foot.php"; exit;}}
$msg_time=time()-$conf_antiflood;
if($m_antiflood>$msg_time){
include_once "../css/red/index.php";
echo'<p align="center"><br><b>Анти-флуд: нельзя добавлять сообщения слишком часто!</b></p>';
include_once "../css/red/foot.php"; exit;}
if(empty($temname)){
include_once "../css/red/index.php";
echo'<br><p align="center"><b>Забыли написать название темы</b></p>';
include_once "../css/red/foot.php"; exit;}
if(empty($msg)){
include_once "../css/red/index.php";
echo'<br><p align="center"><b>Забыли написать сообщение</b></p>';
include_once "../css/red/foot.php"; exit;}
if(win_to_utf(strlen(utf_to_win($msg)))<4 || win_to_utf(strlen(utf_to_win($msg)))>2000){
include_once "../css/red/index.php";
echo'<br><p align="center"><b>Сообщение слишком короткое или длинное</b></p>';
include_once "../css/red/foot.php"; exit;}
if(win_to_utf(strlen(utf_to_win($temname)))<4 or win_to_utf(strlen(utf_to_win($temname)))>30){
include_once "../css/red/index.php";
echo'<br><p align="center"><b>Название слишком короткое или длинное</b></p>';
include_once "../css/red/foot.php"; exit;}
$fmfile = file_get_contents("$maindir/forum/data/forum/razd$razdel.dat");
if(strpos($fmfile,$temname)!==false){
include_once "../css/red/index.php";
echo'<br><p align="center"><b>Такая тема уже есть!</b></p>';
include_once "../css/red/foot.php"; exit;}
$temname=full_check($temname); $msg=check($msg);
$data = check(date("j.n.y"));
$time = check(date("G:i"));
$ids=time();
$rands=rand(0,9);
$rand=rand(0,9);
$id=full_check("$ids$rands$rand");
$id=full_check($id);
$f = file("$maindir/forum/data/mainforum.dat"); ///// ГЛАВНАЯ
$other = explode("|",$f[$razdel]);
$plusmsg=$other[3]+1;
$plustem=$other[2]+1;
$f[$razdel]="$other[0]|$other[1]|".check($plustem)."|".check($plusmsg)."|$login|".check($temname)."|$time|".check($data)."|$id|\r\n";
$rezultat=implode("",$f);
$fp=fopen("$maindir/forum/data/mainforum.dat","w");
fputs($fp,$rezultat);
$txtrazd=$razdel.'|'.$other[1].'|'.$login.'|'.check($temname).'|'.$id.'|'.$time.'|'.check($data).'|'; ///// РАЗДЕЛ
$txtrazd=str_replace("\r\n", "", $txtrazd);
$fp=fopen("$maindir/forum/data/forum/razd".full_check($razdel).".dat","a+");
fputs($fp,"$txtrazd\r\n");
fclose($fp);
$txttem=$razdel.'|'.$other[1].'|'.$login.'|'.check($temname).'|'.$id.'|'.check($msg).'|'.$time.'|'.check($data).'|'.$ip.'||'; ///// ТЕМА
$txttem=str_replace("\r\n", "", $txttem);
$fp=fopen("$maindir/forum/data/forum/".full_check($id).".tem","a+");
fputs($fp,"$txttem\r\n");
fclose($fp);
$fff = file("$maindir/forum/data/users/$login.log"); // +1 балл
$udata = explode("|",$fff[0]);
$ballplus=$udata[20]+1;
$forumplus=$udata[21]+1;
$text=$udata[0].'|'.$udata[1].'|'.$udata[2].'|'.$udata[3].'|'.$udata[4].'|'.$udata[5].'|'.$udata[6].'|'.$data[7].'|'.$udata[8].'|'.$udata[9].'|'.$udata[10].'|'.$udata[11].'|'.$udata[12].'|'.$udata[13].'|'.$udata[14].'|'.$udata[15].'|'.$udata[16].'|'.$udata[17].'|'.$udata[18].'|'.$udata[19].'|'.$ballplus.'|'.$forumplus.'|'.$udata[22].'|'.$udata[23].'|'.$udata[24].'|'.$udata[25].'|'.$udata[26].'|'.$udata[27].'|'.$udata[28].'||';
$text=str_replace("\r\n", "", $text);
$fp=fopen("$maindir/forum/data/users/$login.log","r+");
fputs($fp,"$text");
fclose($fp);
if($ver=="web"){ header ("Location: web.php?addtema&messages&tem=$razdel&id=$id"); }else{
header ("Location: index.php?addtema&messages&tem=$razdel&id=$id"); } exit;}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////// ДОБАВЛЕНИЕ РАЗДЕЛА /////////////////////////////////////////////////////////////////
if($m_level=="1" || $m_level=="2"){
if (isset($_POST['razdel'])) $razdel = $_POST['razdel'];
if(empty($razdel)){
include_once "../css/red/index.php";
echo'<br><p align="center"><b>Забыли написать название раздела</b></p>';
include_once "../css/red/foot.php"; exit;}
if(win_to_utf(strlen(utf_to_win($razdel)))<3 or win_to_utf(strlen(utf_to_win($razdel)))>26){
include_once "../css/red/index.php";
echo'<br><p align="center"><b>Название слишком короткое или длинное</b></p>';
include_once "../css/red/foot.php"; exit;}
$razdel=check($razdel);
$openf = @file("$maindir/forum/data/mainforum.dat");
$array = @array_reverse($openf);
$all_f = count($array);
$textmsg=$all_f.'|'.$razdel.'|0|0||||||';
$fp=fopen("$maindir/forum/data/mainforum.dat","a+");
fputs($fp,"$textmsg\r\n");
fclose($fp);
chmod ("$maindir/forum/data/mainforum.dat", 0666);
//---
$fp=fopen("$maindir/forum/data/forum/razd".full_check($all_f).".dat","a+");
fclose($fp);
chmod ("$maindir/forum/data/forum/razd".full_check($all_f).".dat", 0666);
if($ver=="web"){ header ("Location: web.php?addrazd".SID); }else{
header ("Location: index.php?addrazd".SID); }
}else{ echo'Гуляй нахуй!'; exit;}}else{
include_once "../css/red/index.php";
echo'Вы не авторизованы'; include_once "../css/red/foot.php"; exit;}
?>