<?php
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
include_once"../template/isset.php";
////////////////////проверка / оприделение ip пользователя//////////////
if (preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $_SERVER['HTTP_X_FORWARDED_FOR'])){$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];}
elseif(preg_match("/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/", $_SERVER['HTTP_CLIENT_IP'])) {$ip = $_SERVER['HTTP_CLIENT_IP'];}
else {$ip = preg_replace("/[^0-9.]/", "",$_SERVER['REMOTE_ADDR']);}
$ip=htmlspecialchars(stripslashes($ip));
////////////////////////////////////////////////////////////////////////
if(file_exists(BASEDIR."local/proxy/$ip.txt")){
$con_ip = file(BASEDIR."local/proxy/sett.dat");
if ($con_ip){
$con_dataip = explode(":||:",$con_ip[0]);}
echo $con_dataip[0];
echo'<br>авторы скрипта <a href="http://wap-ray.ru">Revolution and Sliva))</a><br> ваш ip: ';
echo "$ip <br>";
}else{
$text = file("../local/profil/$log.prof");
if ($text!=""){
$udata = explode(":||:",$text[0]);
$provlog=trim($udata[0]);
$provpar=trim($udata[1]);
$dostup=trim($udata[7]);}
///////////////Защита ёпть///////////////////
if(eregi("[^a-z0-9-]",$uz)) {
$ufile = file(BASEDIR."local/profil/$log.prof");
$udata = explode(":||:",$ufile[0]);
$udata[37]=1;
$udata[38]=1219327581;
$udata[39]='PHP инъекции на форуме! Если произошла ошибка - отпишитесь в объяснениях...';
for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}
if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen(BASEDIR."local/profil/$log.prof","a+");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
unset($utext);}
include_once"../themes/$config_themes/foot.php"; exit;}
if(eregi("[^a-z0-9-]",$id)) {
$ufile = file(BASEDIR."local/profil/$log.prof");
$udata = explode(":||:",$ufile[0]);
$udata[37]=1;
$udata[38]=1219327581;
$udata[39]='PHP инъекции на форуме! Если произошла ошибка - отпишитесь в объяснениях...';
for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}
if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen(BASEDIR."local/profil/$log.prof","a+");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
unset($utext);}
include_once"../themes/$config_themes/foot.php"; exit;}
if (ereg('.php',$file[0]) || ereg('.wmls',$file[0]) || ereg('.wml',$file[0]) || ereg('.html',$file[0]) || ereg('.xhtml',$file[0]) || ereg('.shtml',$file[0])
|| ereg('.php1',$file[0]) || ereg('.php2',$file[0]) || ereg('.php3',$file[0]) || ereg('.php4',$file[0]) || ereg('.php5',$file[0])|| ereg('.php.jpg',$file[0])|| ereg('.phtml',$file[0]))
///////////////////Кончилась защита= Дальше копец//////////////////////////
$date=date("d.m.y");
$time=date("H:i");
function format($name){
$f1=strrpos($name,".");
$f2=substr($name,$f1+1,999);
$fname=strtolower($f2);
return $fname;}
$count_lines=file(BASEDIR."local/dataforum/mainforum.dat");
$count=count($count_lines);
$nf="0"; $af="-1"; $uf=$count-1;
$fids="0"; $alltem="0"; $allmsg="0";
do {$af++; $dtf=explode("|", $count_lines[$af]);
$alltem=$alltem+$dtf[4]; $allmsg=$allmsg+$dtf[5];
} while($af < $uf);
$d=rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$host=$_SERVER['SERVER_NAME'];
echo'<img src="../images/img/menu.gif" alt=""> <b>Форум '.$config_title.'</b><br>';
//---------------------------- Показ Кто В Комнате -----------------------------------------//
echo "<hr><div class=b><b>Сейчас на форуме:</b> ";
$file = @file("../local/who.dat");
$file = array_reverse($file);
$total = count($file);
for ($i = 0; $i < $config_lastusers; $i++)
{
$data = explode("|",$file[$i]);
$cur=time();
$cu=$cur-$data[3];
$cu=round($cu/60);
$ava = file("../local/profil/$data[0].prof");
$avv = explode(":||:",$ava[0]);
if($cu<10)
{
if(!eregi("[^a-z0-9-]",$data[0]))
{
if($data[1] == "/forum/index.php") { echo'<a href="../pages/anketa.php?uz='.$data[0].'&'.SID.'">';
if($avv[65]!="" && $avv[65]!=""){
echo''.$avv[65].'';}else{
echo''.$data[0].''; }
echo'</a> | '; }
}
}
}
echo "</div><hr>";
//--------------------------------------------------------//
if ($_SESSION['log']!="" && md5($_SESSION['par'])!="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog ) {
if($udata[10]>0){
echo'<img src="../images/img/mail.gif" alt=""> <b><a href="../pages/privat.php?'.SID.'"><font color="red">Приватное сообщение! ('.$udata[10].')</font></a></b><br>';}
$name=$log;
if(isset($_GET['event'])){
if (isset ($_GET['msg']) or isset ($_GET['name'])){header ("Location: index.php?fid=$fid&isset=nopost&".SID); exit;}
if (($_GET['event']=="addtopic") or ($_GET['event']=="addanswer") or ($_GET['event']=="redanswer")) {
//--------------------- Новый антифлуд -----------------------------//
if($config_floodstime > 0){
if(flooder($ip, $php_self) == TRUE ){header ("Location: index.php?fid=$fid&isset=antiflood&".SID); exit;}
$flood_file = fopen(BASEDIR."local/flood.dat", "a+");
flock ($flood_file,LOCK_EX);
fputs ($flood_file, time()."|$ip|$php_self|\r\n");
fflush($flood_file);
flock ($flood_file,LOCK_UN);
fclose($flood_file);
}
$zag=$_POST['zag']; $msg=$_POST['msg']; $fid=$_GET['fid'];
if (isset($_POST['page'])) {$page=$_POST['page'];}
if ($_GET['event']=="addanswer" || $_GET['event']=="redanswer") {
//------------------------ Проверка существования темы --------------------//
$provfile=file("../local/dataforum/$id.dat");
$provfile = array_reverse($provfile);
$provmas = explode("|",$provfile[0]);
if($provmas[3]!=$zag){header ("Location: index.php?fid=$fid&".SID); exit;}
if (!ctype_digit($id)) {header ("Location: index.php?".SID);exit;}
}
if (!ctype_digit($fid)) { header ("Location: index.php?".SID);exit;}
$mainlines = file("../local/dataforum/mainforum.dat");
$i=count($mainlines);
do {$i--; $dt=explode("|", $mainlines[$i]);
if ($dt[0]==$fid) {$realfid=$i; if ($dt[1]=="razdel") {
header ("Location: index.php?".SID); exit;
}}
} while($i>0);
if (!isset($realfid)) { header ("Location: index.php?".SID); exit;}
if (strlen(trim($zag))<5 || strlen(trim($zag))>100) { header ("Location: index.php?fid=$fid&isset=nopost&".SID); exit;}
if (strlen(trim($msg))<5 || strlen(trim($msg))>1200) { header ("Location: index.php?fid=$fid&isset=nopost&".SID); exit;}
//------------------------------ Запись в профиль ----------------------------//
if ($_GET['event']!="redanswer") {
$ufile = file(BASEDIR."local/profil/$log.prof");
$udata = explode(":||:",$ufile[0]);
$udata[14]=$ip;
$udata[8]++;
$udata[36]++;
$udata[41]++;
for ($u=0; $u<$config_userprofkey; $u++){
$utext.=$udata[$u].':||:';}
if($udata[0]!="" && $udata[1]!="" && $udata[4]!="" && $utext!=""){
$fp=fopen(BASEDIR."local/profil/$log.prof","a+");
flock($fp,LOCK_EX);
ftruncate($fp,0);
fputs($fp,$utext);
fflush($fp);
flock($fp,LOCK_UN);
fclose($fp);
unset($utext);
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
$f = file("../local/local.dat");
$u = explode("|",$f[0]);
$u[2]++;
$t= $u[0].'|'.$u[1].'|'.$u[2].'|'.$u[3].'|'.$u[4].'|'.$u[5].'|'.$u[6].'|'.$u[7].'|'.$u[8].'|'.$u[9].'|'.$u[10].'|';
$fp = fopen("../local/local.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
fputs($fp,$t);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod($fp, 0777);
chmod("../local/local.dat", 0777);
}
if($id!=""){
$locked="";
$provfile=file("../local/dataforum/$id.dat");
$provfile = array_reverse($provfile);
$provmas = explode("|",$provfile[0]);
if($provmas[10]=="ON"){$locked="ON";}
}
if ($_GET['event'] =="addtopic") {
$tt=explode(' ', microtime()); $ttt="$tt[1]"+"$tt[0]"; $ttf=str_replace(".", "", $ttt); $id=$ttf;}
$tektime=time();
$msg=utf_to_win($msg); $msg=wordwrap($msg,70,' ',1); $msg=win_to_utf($msg);
$brow=check($brow);
$name=check($name);
$msg=check($msg);
$zag=check_full($zag);
$msg=preg_replace ("|[\r\n]+|si","<br>",$msg);
$zag=preg_replace ("|[\r\n]+|si","",$zag);
$msg=str_replace("
","<br>",$msg);
$msg=str_replace("§","<br>",$msg);
if($trans=="y"){$msg=transliter($msg);}
$msg = smiles($msg);
if(!empty($fild1)){
if(($_FILES['fild1']['size']) <= 10240000)
{
$fides = @file_get_contents($_FILES["fild1"]["tmp_name"]);
$prov = htmlspecialchars($fides);
if((!preg_match("/\bphp/i",$_FILES['fild1']['name'])) or (!preg_match("/else/i",$prov)) or (!preg_match("/echo/i",$prov)) or (!preg_match("/print/i",$prov)) or (!preg_match("/base64_decode/i",$prov)) or (!preg_match("/Zend/i",$prov)))
{
$rand = rand(1,99999999);
$namefile = $log.'_'.$rand;
$fild = $_FILES['fild1']['name'];
$format = format($fild);
$upl = 'files/'.$namefile.'.'.$format;
if((copy($_FILES["fild1"]["tmp_name"], $upl))==true)
{
$prfile = '[url=http://'.$host.$d.'/'.$upl.'] '.$fild.' [/url]';
$msg = $msg.'<br/><b>Прикрепленный файл :</b> '.$prfile;
}
}
}
}
if(!empty($fild2)){
if(($_FILES['fild2']['size']) <= 10240000)
{
$fides = @file_get_contents($_FILES["fild2"]["tmp_name"]);
$prov = htmlspecialchars($fides);
if((!preg_match("/\bphp/i",$_FILES['fild2']['name'])) or (!preg_match("/else/i",$prov)) or (!preg_match("/echo/i",$prov)) or (!preg_match("/print/i",$prov)) or (!preg_match("/base64_decode/i",$prov)) or (!preg_match("/Zend/i",$prov)))
{
$rand = rand(1,99999999);
$namefile = $log.'_'.$rand;
$fild = $_FILES['fild2']['name'];
$format = format($fild);
$upl = 'files/'.$namefile.'.'.$format;
if((copy($_FILES["fild2"]["tmp_name"], $upl))==true)
{
$prfile = '[url=http://'.$host.$d.'/'.$upl.'] '.$fild.' [/url]';
$msg = $msg.'<br/>Прикрепленный файл №2: '.$prfile;
}
}
}
}
if(!empty($fild3)){
if(($_FILES['fild3']['size']) <= 10240000)
{
$fides = @file_get_contents($_FILES["fild3"]["tmp_name"]);
$prov = htmlspecialchars($fides);
if((!preg_match("/\bphp/i",$_FILES['fild3']['name'])) or (!preg_match("/else/i",$prov)) or (!preg_match("/echo/i",$prov)) or (!preg_match("/print/i",$prov)) or (!preg_match("/base64_decode/i",$prov)) or (!preg_match("/Zend/i",$prov)))
{
$rand = rand(1,99999999);
$namefile = $log.'_'.$rand;
$fild = $_FILES['fild3']['name'];
$format = format($fild);
$upl = 'files/'.$namefile.'.'.$format;
if((copy($_FILES["fild3"]["tmp_name"], $upl))==true)
{
$prfile = '[url=http://'.$host.$d.'/'.$upl.'] '.$fild.' [/url]';
$msg = $msg.'<br/>Прикрепленный файл №3: '.$prfile;
}
}
}
}
$text=$name.'|рус|('.$brow.', '.$ip.')|'.$zag.'|'.$msg.'|'.$date.'|'.$time.'|'.$id.'|'.$fid.'|'.$tektime.'|'.$locked.'|';
$text=stripslashes($text);
$exd=explode("|",$text); $name=$exd[0]; $zag=utf_to_win($exd[3]);
if (strlen($zag)>36) {$zag=substr($zag,0,30); $zag.="...";}
$zag=win_to_utf($zag);
$lines=file("../local/dataforum/mainforum.dat");
$dt=explode("|", $lines[$realfid]); $dt[5]++;
if ($_GET['event']=="addtopic") {$dt[4]++;}
$txtdat=$dt[0].'|'.$dt[1].'|'.$dt[2].'|'.$id.'|'.$dt[4].'|'.$dt[5].'|'.$name.'|'.$date.'|'.$time.'|'.$tektime.'|'.$zag.'|';
$fp=fopen("../local/dataforum/mainforum.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
for ($i=0;$i<=(sizeof($lines)-1);$i++) {if ($i==$realfid) {fputs($fp,"$txtdat\r\n");} else {fputs($fp,$lines[$i]);}}
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod($fp, 0777);
chmod("../local/dataforum/mainforum.dat", 0777);
}
if ($_GET['event']=="addtopic") {
$fp=fopen("../local/dataforum/topic$fid.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod($fp, 0777);
chmod("../local/dataforum/topic$fid.dat", 0777);
//новый блок авто-удаления старых тем
$dfile=file("../local/dataforum/topic$fid.dat");
$di = count($dfile);
if ($di>$config_topforum) {
$poz=0; $result=0;
$dudata = explode("|",$dfile[$poz]);
while ($result!=3) {
if ($dudata[10]!='ON'){
unlink ("../local/dataforum/$dudata[7].dat");
unset($dfile[$poz]);
$result++;
}
$poz++;
$dudata = explode("|",$dfile[$poz]);
}
$dfp=fopen("../local/dataforum/topic$fid.dat","w");
flock ($dfp,LOCK_EX);
fputs($dfp, implode("",$dfile));
flock ($dfp,LOCK_UN);
fclose($dfp);
}
///////////////////////////////////////
$fp=fopen("../local/dataforum/$id.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod($fp, 0777);
chmod("../local/dataforum/$id.dat", 0777);
////////////////////////////////////////////////////////////////////////////////////
header ("Location: index.php?fid=$fid&id=$id&isset=oktem&".SID);
exit;}
//----------------------- Закрытие тем --------------------------------//
if ($event=="zakr") {
if($id!="" && $fid!=""){
$fileg=file("../local/dataforum/$id.dat");
$line=explode("|", $fileg[0]);
$fileg=array_reverse($fileg);
$ddat=explode("|", $fileg[0]);
if ($ddat[9]!="CLOSED" && $line[0]==$log && $udata[36]>500){
$text=$log.'|рус|('.$brow.', '.$ip.')|'.$ddat[3].'|Тема закрыта для обсуждения!|'.$date.'|'.$time.'|'.$id.'|'.$fid.'|CLOSED|'.$ddat[10].'|';
$text=stripslashes($text);
$fp=fopen("../local/dataforum/$id.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod($fp, 0777);
chmod("../local/dataforum/$id.dat", 0777);
//Тема закрыта для обсуждения!
header ("Location: index.php?event=topic&fid=$fid&id=$id&".SID);
exit;
}}}
if ($event=="addanswer") {
###########################
$lines2=file("../local/dataforum/$id.dat");
$lines2=array_reverse($lines2);
$ddd=explode("|", $lines2[0]);
if ($ddd[9]=="CLOSED"){
header ("Location: index.php?fid=$fid&isset=zakr&".SID);
exit;}
###################################
$fp=fopen("../local/dataforum/$id.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod($fp, 0777);
chmod("../local/dataforum/$id.dat", 0777);
//-------------------- Перемещение топиков при обновлении-----------------------------//
$file=file("../local/dataforum/topic$fid.dat");
$i = count($file);
$udata = explode("|",$file[0]);
foreach($file as $index => $val){
$udata = explode("|",$file[$index]);
$udata2 = explode("|",$text);
if($udata[7]==$udata2[7]){
$fp=fopen("../local/dataforum/topic$fid.dat","w");
flock ($fp,LOCK_EX);
unset($file[$index]);
fputs($fp, implode("",$file));
flock ($fp,LOCK_UN);
fclose($fp);
chmod("../local/dataforum/topic$fid.dat", 0777);
}
}
$fp=fopen("../local/dataforum/topic$fid.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod($fp, 0777);
chmod("../local/dataforum/topic$fid.dat", 0777);
//----------Текущая страница-----------//
$filek=file("../local/dataforum/$id.dat");
$countk=count($filek)-1;
$page=floor($countk/$config_forumpost)*$config_forumpost;
header ("Location: index.php?fid=$fid&id=$id&page=$page&isset=addon&".SID);
exit;}
// редактирование постов
if ($event=="redanswer") {
###########################
$lines2=file("../local/dataforum/$id.dat");
$edit=$_GET['edit'];
$ddd2=explode("|", $lines2[$edit]);
$lines2=array_reverse($lines2);
$ddd=explode("|", $lines2[0]);
$locked=str_replace("\r\n",$ddd[10]);
if ($ddd[9]=="CLOSED"){
header ("Location: index.php?fid=$fid&isset=zakr&".SID);
exit;}
if ($log!=$ddd2[0] &&
$dostup!= 101 &&
$dostup!= 102 &&
$dostup!= 103 &&
$dostup!= 105 )
{header ("Location: index.php?fid=$fid&isset=posts&".SID);
exit; }
if (($ddd2[9] +60 * 10) < time() &&
$dostup!= 101 &&
$dostup!= 102 &&
$dostup!= 103 &&
$dostup!= 105)
{header ("Location: index.php?fid=$fid&isset=posts&".SID);
exit; }
unset($lines2);
###################################
$file=file("../local/dataforum/$id.dat");
$fs=count($file)-1;
$i="-1";
$edit=$_GET['edit'];
$fp=fopen("../local/dataforum/$id.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);
do {$i++;
if ($i==$edit)
{$def=explode("|",$file[$i]);
$text=$def[0].'|рус|'.$def[2].'|'.$def[3].'|'.$msg.'<br>[red][ред. '.$log.' '.$date.'/'.$time.'][/red]|'.$def[5].'|'. $def[6] .'|'.$def[7] .'|'.$def[8] .'|'.$def[9] .'|'.$locked ;
fputs($fp,"$text\r\n");
unset($def);}
else {fputs($fp,$file[$i]);}
}
while($i < $fs);
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod("$fp", 0777);
header ("Location: index.php?fid=$fid&id=$id&page=$page&".SID);
exit;}
}}
/////////////////////////////////////////////////////////////////
if (isset($fid)) {
$mainlines=file("../local/dataforum/mainforum.dat");
$i=count($mainlines);
if (!ctype_digit($fid)) {
echo'<br>Критическая ошибка, отсутствует номер раздела!';
include_once"../themes/$config_themes/foot.php";
exit;}
do {$i--; $dt=explode("|", $mainlines[$i]);
if ($dt[0]==$fid) {$frname=$dt[1];}
} while($i >0);
if (isset($id)) {
if (!ctype_digit($id)) {
echo'<br>Критическая ошибка, отсутствует номер темы!';
include_once"../themes/$config_themes/foot.php";
exit;}
if (is_file("../local/dataforum/$id.dat")) {$lines=file("../local/dataforum/$id.dat"); $dtt=explode("|", $lines[0]); $frtname=$dtt[3]; $frtname.=" ->";} else {$frtname=""; $frname="";}} else {$frtname="";} } else {$frname=""; $frtname="";}
if (!isset($fid) and !isset($id)) {
if (!is_file("../local/dataforum/mainforum.dat")) {
echo'<br><br>Разделы форума не созданы!';
include_once"../themes/$config_themes/foot.php";
exit;}
$lines=file("../local/dataforum/mainforum.dat");
$datasize=sizeof($lines);
if ($datasize==0) {
echo'<br><br>Разделы форума не созданы!';
include_once"../themes/$config_themes/foot.php";
exit;}
$i=count($lines);
$n="0"; $a1="-1"; $u=$i-1;
$fid="0"; $itogotem="0"; $itogomsg="0";
//-------------------------Главная страница форума --------------------------//
//------------------------Рекламный блок------------------------------//
include_once(BASEDIR."local/datamain/forum.dat");
do {$a1++; $dt=explode("|", $lines[$a1]);
if ($dt[1]=="razdel") {echo "$dt[2]";} else {
if (is_file("../local/dataforum/$dt[3].dat")) { $msgsize=sizeof(file("../local/dataforum/$dt[3].dat"));
############
if ($msgsize>$config_forumpost) {for($zi=0; $zi<$msgsize;) {$zii=1+$zi/$config_forumpost; $page=$zi; $zi=$zi+$config_forumpost;}} else {$page=0;}} else {$page=0;}
if ($dt[7]==$date) {$dt[7]='<font color="#FF9900">Сегодня</font></a>';}
$fid="$dt[0]";
if (strlen($dt[10])>0) {$dt[10]='<a href="index.php?fid='.$fid.'&id='.$dt[3].'&page='.$page.'&'.SID.'">'.$dt[10].'</a><br>';
}
echo '<div class=b><img src="../images/img/act.gif" alt=""> <b><a href="index.php?fid='.$fid.'&'.SID.'">'.$dt[1].'</a></b> ';
echo ' ('.$dt[4].'/'.$dt[5].')</div><div>';
if ($dt[10]=="") {echo 'Темы не созданы.<br>';}
else{echo 'Teма: </a>'.$dt[10];}
$aut = file('../local/dataforum/'.$dt[3].'.dat');
$str = explode("|",$aut[0]);
echo 'Написал: '.nickname($dt[6]) ;
echo ' ['.$dt[7].'|'.$dt[8].']</div>';
$itogotem=$itogotem+$dt[4];
$itogomsg=$itogomsg+$dt[5];
}
} while($a1 < $u);
echo'<hr>';
}
if (isset($_GET['fid']) and !isset($_GET['id'])) {
$fid=$_GET['fid']; if (!ctype_digit($fid)) {
echo'<br><br>Попытка взлома.МолодеЦ!.';
include_once"../themes/$config_themes/foot.php";
exit;}
$imax=count(file("../local/dataforum/mainforum.dat")); if (($fid>100) or (strlen($fid)==0)) { echo'<br><br>Раздел удален или не существует!';
include_once"../themes/$config_themes/foot.php";
exit;}
if($config_themes!="wml"){echo '<a href="#down"><img src="../images/img/downs.gif" alt=""></a> ';}
echo '<a href="index.php?'.SID.'">Форум</a> | <b>'.$frname.'</b> | ';
echo '<a href="addtem.php?fid='.$fid.'&'.SID.'">Создать тему</a>';
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){
echo ' | <a href="../mpanel/forum.php?fid='.$fid.'&page='.$page.'&'.SID.'">Админка</a>';}
echo '<br><hr>';
if (is_file("../local/dataforum/topic$fid.dat"))
{
$msglines=file("../local/dataforum/topic$fid.dat");
if (count($msglines)>0) {
$lines=file("../local/dataforum/topic$fid.dat");
//************************************************************//
$ups=0;
while (isset($lines[$ups]))
{ $well=explode("|", $lines[$ups]);
if ($well[10]!="ON")
{ $unlines[]= $lines[$ups]; }
$ups++;
}
$ups=0;
while (isset($lines[$ups]))
{ $well=explode("|", $lines[$ups]);
if ($well[10]=="ON")
{ $unlines[]= $lines[$ups]; }
$ups++;
}
unset($lines);
$lines=$unlines;
//************************************************************//
$i=count($lines); $n="0";
if (isset($_GET['page'])) {$page=$_GET['page'];} else {$page="0";}
if ($page>=$i) {$page=$i-1;}
if ($i-$page-$config_forumtem>=0) {$a1=$i-$page; $u=$a1-$config_forumtem;} else {$a1=$i-$page; $u=0;}
do {$a1--; $dt=explode("|", $lines[$a1]);
$filename=$dt[7];
$msgsize=sizeof(file("../local/dataforum/$filename.dat"));
if (is_file("../local/dataforum/$filename.dat")){
echo '<div class=b>';
#########################
$lin=file("../local/dataforum/$filename.dat");
$lin=array_reverse($lin);
$dc=explode("|", $lin[0]);
if($dc[10]=="ON"){echo '<img src="../images/img/lock.gif" alt=""> ';}
elseif($dc[9]=="CLOSED"){echo '<img src="../images/img/zakr.gif" alt=""> ';}
else{echo '<img src="../images/img/act.gif" alt=""> ';}
##########################################
$aut = file('../local/dataforum/'.$dt[7].'.dat');
$str = explode("|",$aut[0]);
echo '<b><a href="index.php?fid='.$fid.'&id='.$dt[7].'&'.SID.'">'.$dt[3].'</a></b> ('.$msgsize.')</div>';
echo 'Автор: '.$str[0].'';
//////////////////////////////////////////////////////
if ($msgsize>=2) {$linesdat=file("../local/dataforum/$filename.dat");
$dtdat=explode("|", $linesdat[$msgsize-1]);
$dt[0]=$dtdat[0];
$dt[1]=$dtdat[1];
$dt[2]=$dtdat[2];
$dt[5]=$dtdat[5];
$dt[6]=$dtdat[6];
}
if ($dt[5]==$date) {$dt[5]='<font color="#FF9900">Сегодня</font></a>';}
echo '<br>Написал: </a>'.nickname($dt[0]).' ['.$dt[5].'/'.$dt[6].']<br>';
$ba=ceil($msgsize/$config_forumpost);
$ba2=floor(($msgsize-1)/$config_forumpost)*$config_forumpost;
echo'Страницы:';
$asd2=$page+($config_forumpost*5);
for($i=0; $i<$asd2;)
{
if($i<$msgsize && $i>=0){
$ii=floor(1+$i/$config_forumpost);
echo ' <a href="index.php?fid='.$fid.'&id='.$dt[7].'&page='.$i.'&'.SID.'">'.$ii.'</a>';
}
$i=$i+$config_forumpost;}
if($asd2<$msgsize){echo ' ... <a href="index.php?fid='.$fid.'&id='.$dt[7].'&page='.$ba2.'&'.SID.'">'.$ba.'</a>';}
}
} while($a1 > $u);
//----------------------------Вывод всех тем форума------------------------//
$lines=file("../local/dataforum/topic$fid.dat");
$a=count($lines);
$ba=ceil($a/$config_forumtem);
$ba2=floor($a/$config_forumtem)*$config_forumtem;
echo '<br>';
echo'<hr>Страницы:';
$asd=$page-($config_forumtem*2);
$asd2=$page+($config_forumtem*3);
if($asd<$a && $asd>0){echo ' <a href="index.php?fid='.$fid.'&page=0&'.SID.'">1</a> ... ';}
for($i=$asd; $i<$asd2;)
{
if($i<$a && $i>=0){
$ii=floor(1+$i/$config_forumtem);
if ($page==$i) {
echo ' <b>('.$ii.')</b>';
}
else {
echo ' <a href="index.php?fid='.$fid.'&page='.$i.'&'.SID.'">'.$ii.'</a>';
}}
$i=$i+$config_forumtem;}
if($asd2<$a){echo ' ... <a href="index.php?fid='.$fid.'&page='.$ba2.'&'.SID.'">'.$ba.'</a>';}
///////////////////////////////////////////////////////
echo '<br><hr>';
}}
}
if (isset($_GET['fid']) and isset($_GET['id'])) {
$fid=$_GET['fid']; $id=$_GET['id'];
if (!ctype_digit($fid) or !ctype_digit($id)) {
echo'<br><br>Попытка взлома. Идите нахуй.';
include_once"../themes/$config_themes/foot.php";
exit;}
if (!is_file("../local/dataforum/$id.dat")) {
//Тема удалена модератором!
header ("Location: index.php?fid=$fid&isset=delthemes&".SID);
exit; }
else {
$lines=file("../local/dataforum/$id.dat");
########################
$lines2=file("../local/dataforum/$id.dat");
$lines2=array_reverse($lines2);
$ddd=explode("|", $lines2[0]);
if ($ddd[9]=="CLOSED"){
echo '<b><font color="red">Тема закрыта</font></b><br>';
}
##################
if (count($lines)>0) {
$lines=file("../local/dataforum/$id.dat");
$lines2=array_reverse($lines);
$ddd=explode("|", $lines2[0]);
$i=count($lines); $n="0"; $tblstyle="row1";
if (isset($_GET['page'])) {$page=$_GET['page'];} else {$page="0";}
if ($page>=$i) {$page=(round($i/$config_forumpost))*10;}
if ($i<=$config_forumpost) {$page="0";}
if ($page>=1) {$a1=$page;} else {$a1=0;}
if (($a1+$config_forumpost)<$i) {$u=$a1+$config_forumpost;} else {$u=$i;}
do {$dt=explode("|", $lines[$a1]);
//////////////////////////////////////////////////////////////
$statwho='<img src="../images/offline.gif" alt=""> ';
$sublines=file("../local/online.dat");
$subcount=count($sublines);
for ($b=0; $b<$subcount; $b++) {$dtd=explode("#",$sublines[$b]); if ($dt[0]==$dtd[2])
{$statwho='<img src="../images/online.gif" alt=""> ';}}
///////////////////////////////////////////////////////////////
//=============================================================
//=============================================================
$dt[4] = preg_replace('#\[big\](.*?)\[/big\]#si', '<big>\1</big>', $dt[4]);
$dt[4] = preg_replace('#\[b\](.*?)\[/b\]#si', '<b>\1</b>', $dt[4]);
$dt[4] = preg_replace('#\[i\](.*?)\[/i\]#si', '<i>\1</i>', $dt[4]);
$dt[4] = preg_replace('#\[u\](.*?)\[/u\]#si', '<u>\1</u>', $dt[4]);
$dt[4] = preg_replace('#\[del\](.*?)\[/del\]#si', '<del>\1</del>', $dt[4]);
$dt[4] = preg_replace('#\\[red\\](.*?)\\[/red\\]#si', '<font color="FF0000">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\\[green\\](.*?)\\[/green\\]#si', '<font color="00AF00">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\\[blue\\](.*?)\\[/blue\\]#si', '<font color="0000FF">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\\[yellow\\](.*?)\\[/yellow\\]#si', '<font color="ffaa13">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\\[gray\\](.*?)\\[/gray\\]#si', '<font color="8D8D8D">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\\[lblue\\](.*?)\\[/lblue\\]#si', '<font color="1CD1FF">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\\[orange\\](.*?)\\[/orange\\]#si', '<font color="FD8500">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\\[violet\\](.*?)\\[/violet\\]#si', '<font color="DE00EA">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\\[gblue\\](.*?)\\[/gblue\\]#si', '<font color="3396B7">\\1</font>', $dt[4]);
$dt[4] = preg_replace('#\[small\](.*?)\[/small\]#si', '<span class=\'small\'>\1</span>', $dt[4]);
$dt[4] = preg_replace('#\[code\](.*?)\[/code\]#si', '<div class=\'d\'><code style=\'white-space:wrap\'>\1<br></code></div>', $dt[4]);
$dt[4] = preg_replace('#\[quote=(.*?)\](.*?)\[/quote\]#si', '<font color="#333399"><u>\\1 пишет:</u><br><< <i>\\2</i> >></font><br>', $dt[4]);
$dt[4] = preg_replace_callback('~\\[url=(http://.+?)\\](.+?)\\[/url\\]|(http://(www.)?[0-9a-z\.-]+\.[a-z]{2,6}[0-9a-z/\?\.\~&_=/%-:#]*)~', 'url_replace', $dt[4]);
//============================================================
//============================================================
$a1++;
if ($tblstyle=="row1") {$tblstyle="row2";} else {$tblstyle="row1";}
if (!isset($m1)) {
$file1=file("../local/dataforum/$id.dat");
$fs=count($file1)-1;
$dd=explode("|", $file1[$fs]);
$dd2=explode("|", $file1[0]);
if($config_themes!="wml"){echo '<a href="#down"><img src="../images/img/downs.gif" alt=""></a> ';}
echo '<a href="index.php?'.SID.'">Форум</a> | <a href="index.php?fid='.$fid.'&'.SID.'">'.$frname.'</a>';
if ($dd[9]!="CLOSED" && $dd2[0]==$log && $udata[36]>500){echo ' | <a href="index.php?event=zakr&fid='.$fid.'&id='.$id.'&'.SID.'">Закрыть тему</a>';}
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){
echo ' | <a href="../mpanel/forum.php?event=topic&fid='.$fid.'&id='.$id.'&page='.$page.'&'.SID.'">Админка</a><br>';}
echo '<br><img src="../images/img/themes.gif" alt=""> <b>'.$dd[3].'</b><br><hr>';
if ($dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){
if ($ddd[9]!="CLOSED"){
echo '<img src="../images/img/close.gif" alt=""> ';
echo '<a href="../mpanel/forum.php?event=zakr&fid='.$fid.'&id='.$id.'&'.SID.'">Закрыть</a>';
}else{
echo '<img src="../images/img/open.gif" alt=""> ';
echo '<a href="../mpanel/forum.php?event=otkr&fid='.$fid.'&id='.$id.'&'.SID.'">Открыть</a>';}
if ($ddd[10]!="ON"){
echo ' <img src="../images/img/open.gif" alt=""> ';
echo '<a href="../mpanel/forum.php?event=locked&fid='.$fid.'&id='.$id.'&'.SID.'">Закрепить</a><br>';
}else{
echo ' <img src="../images/img/close.gif" alt=""> ';
echo '<a href="../mpanel/forum.php?event=unlocked&fid='.$fid.'&id='.$id.'&'.SID.'">Открепить</a><br>';
}
}
$m1=1;}
echo'<div class=b>';
$ava = file("../local/profil/$dt[0].prof");
$avv = explode(":||:",$ava[0]);
if(!empty($udata[45])){
if($avv[43]!="" && $avv[43]!='noavatar.gif'){
echo'<img src="../'.$avv[43].'" alt=""> ';
}else{
echo '<img src="../images/avators/noavatar.gif" alt=""> '; }
}else {
echo'<img src="../images/img/edit.gif" alt=""> ';}
echo '<b>'.$a1.'. <a href="../pages/anketa.php?uz='.$dt[0].'&'.SID.'">'.nickname($dt[0]).'</a></b> '.$statwho;
$procen=($avv[8]/(int)$allmsg)*100;
$proc=round($procen,1);
echo'[<font color="#0000ff">'.$proc.'%</font>]';
if ($avv[7]!="107"){
if ($avv[7]=="101") echo '<font color="#0000FF"> [Гл.Админ] </font>';
if ($avv[7]=="102") echo '<font color="#881199"> [Админ] </font>';
if ($avv[7]=="103") echo '<font color="#00ff00"> [СМодер] </font>';
if ($avv[7]=="105") echo '<font color="00ffff"> [Модер] </font>';
}
echo'<br><a href="../pages/privat.php?action=submit&uz='.$dt[0].'&'.SID.'"> [ЛС] </a>';
//---------------------------------------------
if($config_themes!=="wml"){
if ( $log== $dt[0] && ($dt[9] +60 * 10) >= time() && !isset($_GET['edit']) ||
$dostup==101 || $dostup==102 || $dostup==103 || $dostup==105){
echo '<a href="index.php?edit='. ($a1-1) .'&fid='.$fid.'&id='.$id.'&page='.$page.'&'. SID .'"> [Ред] </a> ';}
if (!$log=="" && !md5($par)=="" && md5($par)==$provpar && $log==$provlog && $dd[9]!="CLOSED"){
echo '<a href="index.php?num='. ($a1-1) .'&fid='.$fid.'&id='.$id.'&page='.$page.'&'. SID .'"> [Цит] </a>';}
}
//--------------------------------------------
echo '</div>'.$dt[4].'';
if ($avv[69]!=="") {echo '<hr><font color="#0000ff">'.$avv[69].'</font><hr>';}
}while($a1 < $u);
/////////////////////////////////////////////////////////
$lines=file("../local/dataforum/$id.dat");
$a=count($lines);
$ba=ceil($a/$config_forumpost);
$ba2=floor(($a-1)/$config_forumpost)*$config_forumpost;
echo'Страницы:';
$asd=$page-($config_forumpost*3);
$asd2=$page+($config_forumpost*4);
if($asd<$a && $asd>0){echo ' <a href="index.php?fid='.$fid.'&id='.$id.'&page=0&'.SID.'">1</a> ... ';}
for($i=$asd; $i<$asd2;)
{
if($i<$a && $i>=0){
$ii=floor(1+$i/$config_forumpost);
if ($page==$i) {
echo ' <b>('.$ii.')</b>';
}
else {
echo ' <a href="index.php?fid='.$fid.'&id='.$id.'&page='.$i.'&'.SID.'">'.$ii.'</a>';
}}
$i=$i+$config_forumpost;}
if($asd2<$a){echo ' ... <a href="index.php?fid='.$fid.'&id='.$id.'&page='.$ba2.'&'.SID.'">'.$ba.'</a>';}
///////////////////////////////////////////////////
######################
$lines2=file("../local/dataforum/$id.dat");
$lines2=array_reverse($lines2);
$ddd=explode("|", $lines2[0]);
if ($ddd[9]!="CLOSED"){
if ($_SESSION['log']!="" && md5($_SESSION['par'])!="" && md5($_SESSION['par'])==$provpar && $_SESSION['log']==$provlog ) {
if($config_themes!="wml"){
////////////////////////////////////////////////////////////////
if (isset($_GET['num']) && !ereg("[^0-9]",$_GET['num']))
{$def=file("../local/dataforum/$id.dat");
$num=check($_GET['num']);
if ($num <= (count($def)-1))
{$dump=explode("|",$def[$num]);
$niklog=nickname($dump[0]);
$message=$dump[4];
$message=preg_replace('#<br>\[red\]\[(.*?)\]\[/red\]#si', '',$message);
$message=str_replace ("<br>","\r\n",$message);
$message = preg_replace('#\[quote=(.*?)\](.*?)\[/quote\]#si', '', $message);
$message=str_replace('<img src="../images/smiles/',':',$message);
$message=str_replace('.gif" alt="">','',$message);
unset($def);
}
}
elseif (isset($_GET['edit']) && !ereg("[^0-9]",$_GET['edit']))
{$edit=$_GET['edit'];
$all_lines = file("../local/dataforum/$id.dat");
$def = explode("|", $all_lines[$edit]);
if ( $def[0]==$log && $def[9]!="CLOSED" && ($def[9] +60 * 10) >= time() ||
$dostup==101 || $dostup==102 || $dostup==103 || $dostup==105)
{$message=$def[4];
$message=str_replace('<img src="../images/smiles/',':',$message);
$message=str_replace('.gif" alt="">','',$message);
$message=preg_replace('#<br>\[red\]\[(.*?)\]\[/red\]#si', '',$message);
$message=str_replace ("<br>","\r\n",$message);
$message=str_replace ("<br />","\r\n",$message);
unset($def);
unset($all_lines);
}
}
////////////////////////////////////////////////////////////////
echo'<br>';
if ( isset($_GET['edit']))
{ $edit=$_GET['edit'];
echo'<form action="index.php?event=redanswer&edit='.$edit.'&fid='.$fid.'&page='.$page.'&'.SID.'" method="post">';}
else {echo'<form action="index.php?event=addanswer&fid='.$fid.'&page='.$page.'&'.SID.'" method="post" enctype="multipart/form-data">';}
echo'<input type="hidden" name="zag" value="'.$ddd[3].'">';
echo'<input type="hidden" name="id" value="'.$id.'">';
if ( isset($_GET['edit']))
{ echo'<b>Редактирование:</b><br>'; }
else { echo'<b>Сообщение:</b><br>';}
echo'<textarea name="msg" cols="20" rows="3">';
if (isset($_GET['num']) && !ereg("[^0-9]",$_GET['num']))
{echo '[quote='.$niklog.']'.$message.'[/quote]';
}
elseif (isset($message) && !ereg("[^0-9]",$_GET['edit']))
{echo $message ;
}
echo '</textarea><br>';
if($config_translit=="1"){
echo'Транслит: <input name="trans" type="checkbox" value="y" /><br>';}
echo'<input type="submit" value="Отправить" /><br></form>';
}else{
echo'<br>--------------------<br>Сообщение:<br>';
echo'<input name="msg" /><br>';
if($config_translit=="1"){
echo'Транслит: <select name="trans"><option value="0">Нет</option>';
echo'<option value="y">Да</option>';
echo'</select><br>';}
echo'<anchor>Написать';
echo'<go href="index.php?event=addanswer&fid='.$fid.'&page='.$page.'&id='.$id.'&'.SID.'" method="post">';
echo'<postfield name="zag" value="'.$ddd[3].'" />';
echo'<postfield name="trans" value="$(trans)" />';
echo'<postfield name="msg" value="$(msg)" />';
echo'</go></anchor><br>';
}
}else{
echo '<br><br>Вы не авторизованы, чтобы добавить сообщение необходимо<br>';
echo '<b><a href="../pages/vhod.php?'.SID.'">Авторизоваться</a></b> или в начале <b><a href="../pages/registration.php?'.SID.'">Зарегистрироваться</a></b><br>'; }
}else{echo "<br>";}
if($config_themes!="wml"){echo '<a href="#up"><img src="../images/img/ups.gif" alt=""></a> ';}
echo '<a href="../pages/smiles.php?'.SID.'">Смайлы</a>';
echo '<hr> ';
}}}
echo'<a href="top.php?'.SID.'">Топ тем</a> | ';
echo'<a href="topusers.php?'.SID.'">Топ юзеров</a> | ';
echo'<a href="../pages/pravila.php?'.SID.'">Правила</a> | ';
echo'<a href="search.php?'.SID.'">Поиск</a><br>';
echo'<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';}
include_once"../themes/$config_themes/foot.php";
?>