",'>',$text);
$text=str_replace("<",'<',$text);
$text=str_replace("\"",'"',$text);
$text=preg_replace("/\n\n/",'',$text);
$text=preg_replace("/\n/",'
',$text);
$text=preg_replace("/\\\$/",'$',$text);
$text=preg_replace("/\r/",'',$text);
$text=preg_replace("/\\\/",'\',$text);
// ���� magic_quotes �������� - ������ ����� ����� � ���� �������: ��������� (') � ������� ������� ("), �������� ���� (\)
if (get_magic_quotes_gpc()) { $text=str_replace("\"",'"',$text); $text=str_replace("\'",'\'',$text); $text=str_replace("\\",'\',$text); }
$text=str_replace("\r\n","
",$text);
$text=str_replace("\n\n",'
',$text);
$text=str_replace("\n",'
',$text);
$text=str_replace("\t",'',$text);
$text=str_replace("\r",'',$text);
$text=str_replace(' ',' ',$text);
return $text; }
// ������� �������� ����������� �����. ����������: addtop();
function addtop() { global $wrfname,$fskin,$date,$time;
// ���� ���� � ������� ���
if (isset($_COOKIE['wrfcookies'])) {$wrfc=$_COOKIE['wrfcookies']; $wrfc=replacer($wrfc); $wrfc=explode("|", $wrfc); $wrfname=$wrfc[0];} else {unset($wrfname); unset($wrfpass); $wrfpass="";}
echo'';
if (isset($wrfname)) {print "
��� �������
����� [$wrfname]";
$name=strtolower($wrfname); if (is_file("data-pm/$name.dat")) {$linespm=file("data-pm/$name.dat"); $pmi=count($linespm); print"
[���� ��������� � ��: $pmi ��.]";}
}
if (!isset($_COOKIE['wrfcookies']) and !isset($_GET['id'])) {print "
�����������
����";}
if (is_file("$fskin/tiptop.html")) include("$fskin/tiptop.html"); // ���������� ���������� � ��������
print"�������: $date - $time";
return true;}
function prcmp ($a, $b) {if ($a==$b) return 0; if ($a<$b) return -1; return 1;} // ������� ����������
function nospam() { global $max_key,$rand_key; // ������� �������� 2011 !
if (array_key_exists("image", $_REQUEST)) { $num=replacer($_REQUEST["image"]);
for ($i=0; $i<10; $i++) {if (md5("$i+$rand_key")==$num) {imgwr($st,$i); die();}} }
$xkey=""; mt_srand(time()+(double)microtime()*1000000);
$dopkod=mktime(0,0,0,date("m"),date("d"),date("Y")); // ���.���: �������� ������ 24 ����
$stime=md5("$dopkod+$rand_key");// ���.���
echo'';
$nummax=0; for ($i=0; $i<=$max_key; $i++) {
$snum[$i]=mt_rand(0,9); $psnum=md5($snum[$i]+$rand_key+$dopkod);
$secret=mt_rand(0,1); $styles='bgcolor=#EEEEEE';
if ($nummax<3) { if ($secret==1 or $i==0) {$styles='bgcolor=#FFFF00'; $xkey=$xkey.$snum[$i]; $nummax++;}}
echo "\r\n";}
$xkey=md5("$xkey+$rand_key+$dopkod"); //����� + ���� �� config.php + ��� ���������� ����� 24 ����
print"";
return; }
function addmsg($qm) { // ������� ���������� ����/���������
global $wrfname,$maxname,$canupfile,$antispam,$max_key,$rand_key,$max_upfile_size,$smile,$smiles,$valid_types,$datadir;
//�������� ������� IP-������������ �� ���������� ���������� (���� bad_ip.dat)
$ip=$_SERVER['REMOTE_ADDR']; // ���������� IP �����
if (is_file("$datadir/bad_ip.dat")) { $lines=file("$datadir/bad_ip.dat"); $i=count($lines);
if ($i>0) {do {$i--; $idt=explode("|", $lines[$i]);
if ($idt[0]===$ip) exit("
������������ ������������ ��� ������ IP: $ip
����������� ��������� ���-���� �� ��������� �������:
$idt[1].
��� ��������� ������������� ���������,
� ��� ��������� ����/��������� ������������� ���������!
");
} while($i > "1");} unset($lines);}
echo'���
';
if (!isset($wrfname)) print " E-mail ";
else {
if (isset($_COOKIE['wrfcookies'])) {$wrfc=$_COOKIE['wrfcookies']; $wrfc=htmlspecialchars($wrfc); $wrfc=stripslashes($wrfc); $wrfc=explode("|", $wrfc); $wrfpass=replacer($wrfc[1]);} else {unset($wrfpass); $wrfpass="";}
print "$wrfname";}
echo'
���������
��� ������� �����, �������� �� ����� ����� � ���.
��������:
';
if ($smile==TRUE) {$i=count($smiles)-1;
for($k=0; $k<$i; $k=$k+2) {$j=$k+1; print" ";} }
print"��� ������
|
";
if ($canupfile==TRUE and isset($wrfname)) { $max=round($max_upfile_size/10.24)/100;
print "";}
if ($antispam==TRUE and !isset($wrfname)) nospam(); // �������� !
echo'
';
return;} // ����� �������-����� ���������� ����/������
// ������ ����� �� ������ - ������� ����
if(isset($_GET['event'])) {if ($_GET['event']=="clearcooke") {setcookie("wrfcookies","",time()); Header("Location: $furl"); exit;}}
// ���������� ���� ��� ������ - ��� 1
if(isset($_GET['event'])) {
//�������� ������� IP-������������ �� ���������� ���������� (���� bad_ip.dat)
$ip=$_SERVER['REMOTE_ADDR']; // ���������� IP �����
if (is_file("$datadir/bad_ip.dat")) { $lines=file("$datadir/bad_ip.dat"); $i=count($lines);
if ($i>0) {do {$i--; $idt=explode("|", $lines[$i]);
if ($idt[0]===$ip) exit("
������������ ������������ ��� ������ IP: $ip
����������� ��������� ���-���� �� ��������� �������:
$idt[1].
��� ��������� ������������� ���������,
� ��� ��������� ����/��������� ������������� ���������!");
} while($i > "1");} unset($lines);}
if ($stop==TRUE) exit("�������� ���������� ��� � ��������� ��������������!");
if (($_GET['event']=="addtopic") or ($_GET['event']=="addanswer")) {
if (isset($_POST['name'])) $name=$_POST['name'];
$name=trim($name); // �������� ���������� �������
$zag=$_POST['zag']; $msg=$_POST['msg'];
$fid=$_GET['id'];
if ($_GET['event']=="addanswer") $id=substr($fid,3,4);
if (strlen($fid)>3) $fid=substr($fid,0,3);
if (isset($_POST['who'])) $who=$_POST['who']; else $who="";
if (isset($_POST['email'])) $email=$_POST['email']; else $email="";
if (isset($_POST['page'])) $page=$_POST['page'];
if (isset($_POST['maxzd'])) $maxzd=$_POST['maxzd']; else $maxzd="0"; if ($maxzd==null) $maxzd="0";
if ((!ctype_digit($maxzd)) or (strlen($maxzd)>2)) exit("$back. ������� ������ �� ������ ��� ������ � ����� ����������");
if ($nosssilki==TRUE and $_GET['event']=="addanswer" and preg_match("/href|url|http|www|\.ru|\.com|\.net|\.info|\.org/i",$msg) and preg_match("/\.jpg|\.gif|\.jpeg|\.png/is",$msg)<>TRUE and !isset($wrfname)) exit("��������� ����� � IP $ip , ���� �� ������ �������� �������� � ������� �������������� ������ - �������� �����������.
���� �� ������� - ������� ���!
");
// ������ �� ������ fid
if (!ctype_digit($fid) or strlen($fid)>3) exit("$back. ������� ������ ����� ����� �������. ����� ������ ��������� ������ ����� � ���� ����� 4 ��������");
//--�-�-�-�-�-�-�-�--�������� ����--
if ($antispam==TRUE and !isset($_COOKIE['wrfcookies'])) {
if (!isset($_POST['usernum']) or !isset($_POST['xkey']) or !isset($_POST['stime']) ) exit("������ �� ����� �� ���������!");
$usernum=replacer($_POST['usernum']); $xkey=replacer($_POST['xkey']); $stime=replacer($_POST['stime']);
$dopkod=mktime(0,0,0,date("m"),date("d"),date("Y")); // ���.���. �������� ������ 24 ����
$usertime=md5("$dopkod+$rand_key");// ���.���
$userkey=md5("$usernum+$rand_key+$dopkod");
if (($usertime!=$stime) or ($userkey!=$xkey)) exit("����� ��������� ���!");}
// �������� �� ���� �������� � ������� - ���� �������������
// �� ��� ������, ���� mainforum.dat - ����, ���������� ��������� �����
$realbase="1"; if (is_file("$datadir/mainforum.dat")) $mainlines=file("$datadir/mainforum.dat");
if (!isset($mainlines)) $datasize=0; else $datasize=sizeof($mainlines);
if ($datasize<=0) {if (is_file("$datadir/copy.dat")) {$realbase="0"; $mainlines=file("$datadir/copy.dat"); $datasize=sizeof($mainlines);}}
if ($datasize<=0) exit("$back. �������� � ����� ������, ���� ������ ���� - ���������� � ��������������");
$i=count($mainlines);
$realfid=null; $fotodetali="|||";
do {$i--; $dt=explode("|", $mainlines[$i]);
if ($dt[0]==$fid) {$realfid=$i; if ($dt[1]=="razdel") exit("$back. ������ ����� ������ �� ����������");} // ����������� $realfid - � �/� ������
} while($i>0);
if (!isset($realfid)) exit("$back. ������ � ������� �������. ��� �� ���������� � ����");
$dt=explode("|",$mainlines[$realfid]);
if (is_file("$datadir/topic$fid.dat")) {$tlines=file("$datadir/topic$fid.dat"); $tc=count($tlines)-2; $i=$tc+2; $ok=null;
// ����� ����������� �� ������, ����� ����. ���� ���� - �������, ���� - ������ ���������� ��������� ���������!
if ($_GET['event']=="addanswer") {
do {$i--; $tdt=explode("|", $tlines[$i]);
if ($tdt[7]=="$fid$id") {$ok=1; if ($tdt[8]=="closed") exit("$back ���� ������� � ���������� ��������� ���������!"); }
} while($i>0);
if ($ok!=1) exit("$back ���� ������� � ���������� ��������� ���������!"); }
} else $tc="2";
if ($dt[11]>0) {if ($tc>=$dt[11]) exit("$back. ��������� ����������� �� ���-�� ���������� ��� � ������ �������! �� ����� $dt[11] ���!");}
// �������� ������/������ �����. ����� �� �����, ����� ����� ���
// ���� 1
if (isset($_POST['userpass'])) $userpass=replacer($_POST['userpass']); // �������� � ������������ ������ ����� �� ������
else $userpass="";
$realname="";
if (isset($_COOKIE['wrfcookies'])) {
$wrfc=$_COOKIE['wrfcookies']; $wrfc=htmlspecialchars($wrfc); $wrfc=stripslashes($wrfc);
$wrfc=explode("|", $wrfc); $wrfname=$wrfc[0]; $wrfpass=$wrfc[1];
} else {$who=null; $wrfname=null; $wrfpass=null;}
// ���� 2
if ($who!=null) { $who=0; $ok=FALSE;
if ($wrfname!=null & $wrfpass!=null) {
$lines=file("$datadir/usersdat.php"); $i=count($lines);
do {$i--; $rdt=explode("|", $lines[$i]);
if (isset($rdt[1])) { $realname=strtolower($rdt[0]);
if (strtolower($wrfname)===$realname & $wrfpass===$rdt[1] & $userpass===$rdt[1]) {
$name=$wrfname; $who="��"; $ok="$i";}}
} while($i > "1");
if ($ok==FALSE) {setcookie("wrfcookies","",time()); exit("������ ��� ������ � ����! �� �� ������� �������� ���������, ���������� ������ ��� ��� �����. ��� ����� � ������ �� ������� � ���� ������, ���������� ����� �� ����� �����. ���� ������ ����������� - ���������� � �������������� ������.");}
}}
print"";
if ($_GET['event']=="addtopic" and $cangutema==FALSE and !isset($wrfname)) exit("������������� �������� ������ ��������� ����!
");
if ($_GET['event']=="addanswer" and $cangumsg==FALSE and !isset($wrfname)) exit("������������� �������� ������ �������� � �����!
");
if (isset($_FILES['file']['name'])) { // ���� ��������� ����
$fotoname=replacer($_FILES['file']['name']); if (strlen($fotoname)>3) { $fotosize=$_FILES['file']['size']; // ��� � ������ �����
//---- ������ �� ������ -----
// 1. ��������� ����������
$ext = strtolower(substr($fotoname, 1 + strrpos($fotoname, ".")));
if (!in_array($ext, $valid_types)) {echo "���� �� ��������. ��������� �������:
- ��������� �������� ������ ������ � ������ ������������: ";
$patern=""; foreach($valid_types as $v) print"$v, ";
echo'
- �� ��������� ��������� ���� � ������� �����������;
- ������� ����� ����� ��� ������ ����������� ����;
'; exit;}
// 2. ������� ���-�� ����� � ��������� - ���� ������� ����� - ��������!
$findtchka=substr_count($fotoname, "."); if ($findtchka>1) exit("����� ����������� � ����� ����� $findtchka ���(�). ��� ���������!
\r\n");
// 2. ���� � ����� ���� .php, .html, .htm - ��������!
$bag="��������, �� � ����� ����� ��������� ������������ .php, .html, .htm";
if (preg_match("/\.php/i",$fotoname)) exit("��������� .php �������. $bag");
if (preg_match("/\.html/i",$fotoname)) exit("��������� .html �������. $bag");
if (preg_match("/\.htm/i",$fotoname)) exit("��������� .htm �������. $bag");
// 3. �������� �� ������� ���� � ����� ����� � �������� ���������� �����
$patern=""; foreach($valid_types as $v) $patern.="$v|";
if (!preg_match("/^[a-z0-9\.\-_]+\.(".$patern.")+$/is",$fotoname)) exit("$fotoname -
��������� ������������ ������� ����� � ����� �����, � ����� ��������� ��������� ����� � ����������� �������� �� ��������!!");
// 4. ���������, ����� ���� ���� � ����� ������ ��� ���� �� �������
if (file_exists("$filedir/$fotoname")) exit("$back. ���� � ����� ������ ��� ���������� �� �������! ���� �������� ��� �� ������,
���� �������� �������� - �������� �� ��������� �������� ��������� � ���� ��������!!");
// 5. ������ �����
$fotoksize=round($fotosize/10.24)/100; // ������ ������������ ����� � ��.
$fotomax=round($max_upfile_size/10.24)/100; // ������������ ������ ����� � ��.
if ($fotoksize>$fotomax) exit("�� ��������� ���������� ������ �����!
����������� ���������� ������: $fotomax ��.
�� ��������� ��������� ���� ��������: $fotoksize ��!");
// ���� ������� ������� ���������� ����� ���������� ����� ��� �������� - ���������� ��������� ���
if ($random_name==TRUE) {do $key=mt_rand(100000,999999); while (file_exists("$filedir/$key.$ext")); $fotoname="$key.$ext";}
if (copy($_FILES['file']['tmp_name'], $filedir."/".$fotoname)) {print "
���� ������� ��������: $fotoname (������: $fotosize ����)"; $fotodetali="1|$fotoname|$fotosize|";}
else echo "������ �������� ����� - $fotoname...\n"; }}
$tektime=time();
$name=wordwrap($name,30,' ',1); // ��������� ������� ������
$zag=wordwrap($zag,50,' ',1);
$name=str_replace("|","I",$name);
$who=str_replace("|","|",$who);
$email=str_replace("|","|",$email);
$zag=str_replace("|","|",$zag);
$msg=str_replace("|","|",$msg);
$smname=$name; if (strlen($name)>18) {$smname=substr($name,0,18); $smname.="..";}
$smzag=$zag; if (strlen($zag)>24) {$smzag=substr($zag,0,24); $smzag.="..";}
// ���� ���������� ��������� �� ������� ����� ����, ������� �������� � 1000
// ��������� ���� ���� � ������ � ������
if ($_GET['event']=="addtopic") { $id=1000; $id="$fid$id";
$allid=null; $records=file("$datadir/topic$fid.dat"); $imax=count($records); $i=$imax;
if ($i > 0) { do {$i--; $rd=explode("|",$records[$i]); $allid[$i]=$rd[7]; } while($i>0);
//natcasesort($allid); // ��������� �� �����������
do $id++; while(in_array($id,$allid) or is_file("$datadir/$id.dat"));
} else $id=$fid."1000";
$id=substr($id,3,4); // ��� ����� ������ ID �� 4-� ��������
} // if (event==addtopic)
// ���������� ��� ����� � ����� - ������ ��������
//if ($_GET['event']=="addtopic") { if ($fid<10) $add="0"; else $add="";
//do $id=mt_rand(1000,9999); while (file_exists("$datadir/$add$fid$id.dat"));
//$id="$add$fid$id"; }
if (strlen($id)>8) exit("$back. ����� ���� ������ ���� ������. ����������� ������ ������� ��� ������� ������");
if (strlen(ltrim($zag))<3) exit("$back ! ������ � ����� ������ ���������!");
$ip=$_SERVER['REMOTE_ADDR']; // ���������� IP �����
$text="$name|$who|$email|$zag|$msg|$date|$time|$fid$id||$tektime|$smname|$smzag|$fotodetali|$ip||||";
$text=replacer($text); $exd=explode("|",$text);
$name=$exd[0]; $zag=$exd[3]; $smname=$exd[10]; $smzag=$exd[11]; $smmsg=$exd[4];
if (!isset($name) || strlen($name) > $maxname || strlen($name) <1) exit("$back ���� ��� ������, ��� ��������� $maxname ��������!");
if (preg_match("/[^(\\w)|(\\x7F-\\xFF)|(\\-)]/",$name)) exit("$back ���� ��� �������� ����������� �������. ��������� ������� � ���������� �����, �����, ������������� � ����.");
if (strlen(ltrim($zag))<3 || strlen($zag) > $maxzag) exit("$back ������� �������� �������� ���� ��� �������� ��������� $maxzag ��������!");
if (strlen(ltrim($msg))<2 || strlen($msg) > $maxmsg) exit("$back ���� ��������� �������� ��� ��������� $maxmsg ��������.");
if (!preg_match('/^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,9})$/si',$email) and strlen($email)>30 and $email!="") exit("$back � ������� ���������� E-mail �����!");
// ������� �������� ����� - ��������� ���������� ���������/���� ���������!
if (isset($tlines)) {
if ($tc<"-1") {$sdt[0]=null; $sdt[3]=null;} else {$last=$tlines[$tc+1]; $sdt=explode("|",$last);}
if ($_GET['event'] =="addtopic") { // ���� ���������� ����: ��� = ��� � �����, ���� = ��������� ���� � �����
if ($name==$sdt[0] and $exd[3]==$sdt[3]) exit("$back. ����� ���� ��� �������. ������� �� ������ ���������!");
} else { // ���� ���������� ���������: ��� = ��� � �����, ��������� = ���������� ��������� � �����
if (is_file("$datadir/$fid$id.dat")) {$linesn=file("$datadir/$fid$id.dat"); $in=count($linesn)-1;
if ($in > 0) { $dtf=explode("|",$linesn[$in]);
if ($name==$dtf[0] and $exd[4]==$dtf[4]) exit("$back. ����� ��������� ��� ��������� � ������ ����. ������� �� ������ ���������!");}
}
}} // if $event=="addtopic"
// ���� ������� ������� ��, �� ������ ���� �������� ����� � ���� ����� ������ �����
if ($_GET['event'] =="addanswer") { //��� ������ � ����
$pageadd=""; // ����������� ������ �������� � ����� ���������
if ($_GET['event']=="addanswer") {$in=$in+2; $page=ceil($in/$qq); if ($page!=1) $pageadd="&page=$page";}
// ���������, ����� �� �������������� ����
$timetek=time(); $timefile=filemtime("$datadir/$fid$id.dat");
$timer=$timetek-$timefile; // ������ ������� ������ ������� (� ��������)
// $timer<10 - 10 ������ ������ �� ���������
if ($smmsg=="��!") {
if ($timer<10 and $timer>0) exit("$back ���� ���� ������� ����� $timer ������ �����. ��������� ����-����.");
touch("$datadir/$fid$id.dat");
print "
�������, $name, ���� ��������������.
����� ��������� ������ �� ������ ������������� ���������� � ������� ���� $zag.
������ >>> |
|
";
exit; }
if ($timer<10 and $timer>0) exit("$back ���� ���� ������� ����� $timer ������ �����.");
}
$razdelname="";
if ($realbase==TRUE and $maxzd<1) { // ���� ���������� ������� ����, � �� �����
$lines=file("$datadir/mainforum.dat"); $max=sizeof($lines)-1;
$dt=explode("|", $lines[$realfid]); $dt[5]++; $main_id="$fid$id";
if ($_GET['event']=="addtopic") $dt[4]++;
$txtdat="$dt[0]|$dt[1]|$dt[2]|$main_id|$dt[4]|$dt[5]|$smname|$date|$time|$tektime|$smzag|$dt[11]|$dt[12]||||";
$razdelname=$dt[1];
// ������ ������ �� ������� ��������
$fp=fopen("$datadir/mainforum.dat","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);//������� ���������� �����
for ($i=0;$i<=$max;$i++) {if ($i==$realfid) fputs($fp,"$txtdat\r\n"); else fputs($fp,$lines[$i]);}
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
} // if ($realbase==TRUE)
if ($newmess==TRUE and $maxzd<1) { // ������ � ��������� ���� ������ ���������
if (is_file("$datadir/topic$fid.dat")) $nlines=count(file("$datadir/topic$fid.dat")); else $nlines=1;
if (is_file("$datadir/$fid$id.dat")) $nlines2=count(file("$datadir/$fid$id.dat"))+1; else $nlines2=1;
$newmessfile="$datadir/news.dat";
$newlines=file("$newmessfile"); $ni=count($newlines)-1; $i2=0; $newlineexit="";
$ntext="$fid|$main_id|$date|$time|$smname|$zag|$msg|$nlines|$nlines2|$razdelname|$who||||";
$ntext=str_replace("
", "
", $ntext);
// ���� ���������, ���� �� ��� ����� ��������� � ���� ����. ���� ���� - ���������. �� ������ - ������ ��� ���� ������.
for ($i=0;$i<=$ni;$i++) { $ndt=explode("|",$newlines[$i]);
if (isset($ndt[1])) {if ("$fid$id"!=$ndt[1]) $newlineexit.="$newlines[$i]"; $i2++; } }
// ���������� ������ ��������� � ������ � ����� ��������� ��� � ����
if ($maxzd<1) { // ���� ���� �������� ��� ���� - ��� ����������� �� ������
if ($i2>0) { // ���� ���� ����� ����, �� ����� ���� ������, ����� ���� ������
$newlineexit.=$ntext;
$fp=fopen("$newmessfile","w");
flock ($fp,LOCK_EX);
fputs($fp,"$newlineexit\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
} else {
$fp=fopen("$newmessfile","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$ntext\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);}
$file=file($newmessfile);$i=count($file);
if ($i>="15") {
$fp=fopen($newmessfile,"w");
flock ($fp,LOCK_EX);
unset($file[0]);
fputs($fp, implode("",$file));
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);}
}
}
} // if ($newmess==TRUE)
// ���� ��������� +1 � ���� � +1 � ��������� ��� +1 � ���-�� ���, ��������� ������
if (isset($_COOKIE['wrfcookies']) and ($ok!=FALSE)) {
$ufile="$datadir/userstat.dat"; $ulines=file("$ufile"); $ui=count($ulines)-1; $ulinenew=""; $fileadd=0;
// ���� ���� ��������� ���� - �� ��� ��� +5 � ����
if (isset($_FILES['file']['name']) and $repaaddfile!=FALSE) {if (strlen($_FILES['file']['name'])>1) $fileadd=$repaaddfile;}
// ���� ����� �� ����� � ����� userstat.dat
for ($i=0;$i<=$ui;$i++) {$udt=explode("|",$ulines[$i]);
if ($udt[0]==$wrfname) {
$udt[2]++; $udt[3]=$udt[3]+$fileadd;
if ($_GET['event']=="addtopic") {$udt[1]++; $udt[3]=$udt[3]+$repaaddtem;} else $udt[3]=$udt[3]+$repaaddmsg;
$ulines[$i]="$udt[0]|$udt[1]|$udt[2]|$udt[3]|$udt[4]|$udt[5]||||\r\n";}
$ulinenew.="$ulines[$i]";}
// ����� ������ � ����
$fp=fopen("$ufile","w");
flock ($fp,LOCK_EX);
fputs($fp,"$ulinenew");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp); }
if ($sendadmin==TRUE) { // ���������� ���������� �� ������ � ���� ��������������
$headers=""; // ��������� ��� �������� �����
$headers.="Content-Type: text/html; charset=windows-1251\r\n";
$headers.="From: Robot <".$adminemail.">\r\n";
$headers.="X-Mailer: WR-Forum PHP/".phpversion();
// ��������� ������ ������ 200 �������� ���������
$msgmax=strlen($msg); if ($msgmax>200) $msgmax=200; $msg=substr($msg,0,$msgmax); $msg=replacer($msg);
// �������� ��� ���������� � ���� ������
$allmsg="
��� ��������� ���������� ��� �������
������ $fname
���������: | �� ������ ��������� ����� ��������� �� $name.
��� ����� ���������:
$msg
���������� ��� ���������.
����� ��� �������!
|
���� �������� ���������: | $time - $date �. |
������� �� ������� ��������: | $furl |
|
* ������ ������ ������������� � ���������� �������, �������� �� ���� �� �����.
";
mail("$adminemail","=?windows-1251?B?".base64_encode("��������� �� ������ $fname")."?=",$allmsg,$headers);
} // if $sendadmin==TRUE
if ($_GET['event'] =="addtopic") { // ���������� ���� - ������ ������
// ����� � �����
$fp=fopen("$datadir/topic$fid.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
// ����� � ����
$fp=fopen("$datadir/$fid$id.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
print "
�������, $name, �� ���������� ����!
����� ��������� ������ �� ������ ������������� ���������� � ��������� ����.
������ >>> |
|
";
exit; }
if ($_GET['event'] =="addanswer") { //����� � ���� - ������ ������
$timetek=time(); $timefile=filemtime("$datadir/$fid$id.dat");
$timer=$timetek-$timefile; // ������ ������� ������ ������� (� ��������)
$fp=fopen("$datadir/$fid$id.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$text\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
if ($timer<0) {$viptime=strtotime("+2 year"); touch("$datadir/$fid$id.dat",$viptime);}
print "
�������, $name, ��� ����� ������� ��������.
����� ��������� ������ �� ������ ������������� ���������� � ������� ���� $zag.
������ >>> |
|
";
exit;
}
}
//--------------- ����� ��� ���� ������� ������ ------------//
// ���������� ���� ���������� ������. +5 ����� ����������� //
if (isset($_COOKIE['wrfcookies'])) {
$wrfc=$_COOKIE['wrfcookies']; $wrfc=explode("|",replacer($wrfc));
$wrfname=$wrfc[0];$wrfpass=$wrfc[1];$wrftime1=$wrfc[2];$wrftime2=$wrfc[3];
if (time()>($wrftime1+240)) { $tektime=time(); $wrfcookies="$wrfc[0]|$wrfc[1]|$tektime|$wrftime1|";
setcookie("wrfcookies", $wrfcookies, time()+1728000);
$wrfc=$_COOKIE['wrfcookies']; $wrfc=explode("|",replacer($wrfc));
$wrfname=$wrfc[0];$wrfpass=$wrfc[1];$wrftime1=$wrfc[2];$wrftime2=$wrfc[3];
} }
// ------------
// ���� ���������� ����� �������� ����� ��� �����������
if (is_file("$datadir/mainforum.dat")) $mainlines=file("$datadir/mainforum.dat"); $imax=count($mainlines); $i=$imax;
if (!isset($mainlines)) $datasize=0; else $datasize=sizeof($mainlines);
if ($datasize<=0) {if (is_file("$datadir/copy.dat")) {$mainlines=file("$datadir/copy.dat"); $datasize=sizeof($mainlines);}}
if ($datasize<=0) exit("���� ������ ������������! ������� � ������� � �������� �������!");
$error=FALSE; $frname=null; $frtname=""; $rfid="";
// ��� ������ ���� razdel=
if (isset($_GET['razdel'])) {
do {$i--; $dt=explode("|", $mainlines[$i]);
if ($dt[0]==$_GET['razdel']) {$rfid=$i; $frname="$dt[2] ->";}
} while($i >0);
$i=$imax;}
if (isset($_GET['id'])) { // ���� ������� � ��������� ������: ���� -> ������ -> �����
$id=$_GET['id'];
if (strlen($id)<=3 and !is_file("$datadir/topic$id.dat")) $error="�� ���� ������";
if (strlen($id)> 3 and !is_file("$datadir/$id.dat")) $error="�� ���� ����";
if (!ctype_digit($id)) $error="�� ���� ���� ��� ������";
if (isset($_GET['quotemsg'])) $error=TRUE;
if(strlen($id)>3) {$fid=substr($id,0,3); $id=substr($id,3,4);} else $fid=$id;
// �������� �� ���� �������� � ������� - ���� �������������
do {$i--; $dt=explode("|", $mainlines[$i]);
if ($dt[0]==$fid) { $frname="$dt[1] ->";
if (isset($dt[11])) { if($dt[11]>0) $maxtem=$dt[11]; else $maxtem="999";}}
} while($i >0);
//$frtname="1"; $frname="2"; $fname="3";
// ���� ��������� �������� ���� ��� ����������� � ����� ������
if (strlen($id)>3 and is_file("$datadir/topic$fid.dat")) {
$lines=file("$datadir/topic$fid.dat"); $imax=count($lines); $i=$imax;
do {$i--; $dt=explode("|",$lines[$i]);
if($dt[7]=="$fid$id") $frtname="$dt[3] ->";
} while ($i>0); }
if ($error==TRUE) { // ��������� ���������� ������� � ������������ / ���˨���� ������� / ����!
$topurl="$fskin/top.html";
ob_start(); include $topurl; $topurl=ob_get_contents(); ob_end_clean();
$topurl=str_replace("",'',$topurl);
print"$topurl";
if (strlen($error)>1) exit("��������, �� �����������$error �����������.
���������� ������� �� ������� �������� ������ ��
���� ������,
� ����� ������������ ��� ����.
"); }
// ����� ��������� ���������� �� ��������, �� ������� ������ ����
if (strlen($id)==3) { $lines=file("$datadir/topic$id.dat"); $imax=count($lines);
if (isset($_GET['page'])) $page=$_GET['page']; else $page=1;
$maxikpage=ceil($imax/$qqmain); if ($page>$maxikpage and $imax!=0) {
$topurl="$fskin/top.html";
ob_start(); include $topurl; $topurl=ob_get_contents(); ob_end_clean();
$topurl=str_replace("",'',$topurl);
print"$topurl";
exit("
�������� �����������! |
����� �������� ���. � ���� ������� ����� $maxikpage �������. �� ������ �������
�� ������ ��� ��������� ��������.
����� ��������� ������ �� ������ ���������� �� ��������� ��������.
|
");
$error=TRUE; }}
} // if (isset($_GET['id']))
if ($error==FALSE) include("$fskin/top.html"); addtop(); // ���������� ����� ������
// ������� ������� �������� ������
if (is_file("$datadir/usersdat.php")) { // ��������� ��� ���������� ���������������������
$userlines=file("$datadir/usersdat.php"); $dayx="";
$usercount=count($userlines); $ui=$usercount-1; $uu=$ui;
$tdt=explode("|", $userlines[$ui]);} else { $fp=fopen("$datadir/usersdat.php","a+"); fputs($fp,"\r\n"); fflush ($fp); fclose($fp); $ui=""; $tdt[0]="";}
$today=mktime();
if (!isset($_GET['id'])) {
if (strlen($frname)>1) {$frname=str_replace('->','',$frname); $frname="-> $frname";}
print"
";
// ������� ��� ������� �� �������
$adminmsg=""; if (is_file("$datadir/mainforum.dat")) $lines=file("$datadir/mainforum.dat");
if (!isset($lines)) $datasize=0; else $datasize=sizeof($lines);
if ($datasize<=0) {if (is_file("$datadir/copy.dat")) {$lines=file("$datadir/copy.dat"); $datasize=sizeof($lines);} $adminmsg="�������������, ��������!!! ���� �� � ��������� ��������. ������������ ��� �� ��������� ����� � �������!
";}
if ($datasize<=0) exit("�������� � ����� ������ - ���������� � ��������������");
$i=count($lines); $n="0"; $a1=$rfid-1; $u=$i-1; $fid="0"; $itogotem="0"; $itogomsg="0"; $alt=""; $konec="";
do {$a1++; $dt=explode("|", $lines[$a1]);
if (isset($dt[1])) { // ���� ������� ���������� � ������� (������ ������) - �� ������ � �� �������
if ($dt[1]=="razdel" and isset($_GET['razdel'])) $konec++; else {
// ���������� ���: ����� ��� ���������
if ($dt[1]=="razdel") print "";
else {
//$dt[9] - ���� ���������� ���������; $wrftime2 - ��������� ���������
// ���� $dt[9] ������ (�.�. ������) $wrftime2 ������ ������ ������ - �����
$foldicon="folder.gif"; if (isset($wrfname)) {if (isset($dt[9])) {if ($dt[9]>$wrftime2) $foldicon="foldernew.gif";}}
if (is_file("$datadir/$dt[3].dat")) { $msgsize=sizeof(file("$datadir/$dt[3].dat")); // ������� ���-�� ������� � �����
if ($msgsize>$qq) $page=ceil($msgsize/$qq); else $page=1;} else $page=1;
if ($page!=1) $pageadd="&page=$page"; else $pageadd="";
if ($dt[7]==$date) $dt[7]="�������";
$maxzvezd=null; if (isset($dt[12])) { if ($dt[12]>=1) {$maxzvezd="*�������� ����������, ������� $dt[12] �����";
$dt[4]=""; $dt[5]="";
if ($dt[12]==1) $maxzvezd.="�";
if ($dt[12]==2 or $dt[12]==3 or $dt[12]==4) $maxzvezd.="�";
$maxzvezd.=" �������";}}
$fid="$dt[0]";
// �����: ���� ���� ����� ���� main-FID.gif, ��� FID - �����, �� ������ ������� ���������������, ������ ���� ����
if (is_file("$fskin/main-$fid.gif")) {$foldicon="main-$fid.gif"; $alt="$dt[1]";} else $alt="";
$dt[8]=substr($dt[8],0,-3);
$dt[10]=replacer($dt[10]);
print "\r\r\n";
$itogotem=$itogotem+$dt[4];$itogomsg=$itogomsg+$dt[5]; }} if ($konec==2) $a1=$u;
} // if isset($dt[1]
} while($a1 < $u);
echo('
������ |
��� |
������� |
���������� |
$dt[2] | |
 |
$dt[1] $maxzvezd $dt[2] |
$dt[4] |
$dt[5] |
����: "; if (strlen($dt[10])>0) print "$dt[10]"; print" �����: $dt[6] ����: $dt[7] - $dt[8] |
');
// ������� ������� � ����
echo '��������� |
������� ������� �� �������� |
';
if ($statistika==TRUE and !isset($_GET['razdel'])) { // ���������� ����� ���/���������/����� ������
if ($cangutema==TRUE) $c1="���������"; else $c1="���������";
if ($cangumsg ==TRUE) $c2="���������"; else $c2="���������";
$codename=urlencode($tdt[0]);
print"���������� |
 |
���������: $itogomsg ���: $itogotem ����� ���������������� ����������: ";
if (!isset($wrfname)) print"$ui"; else print"$ui";
echo' ��������� �����������������: ';
if (!isset($wrfname)) print"$tdt[0]"; else print"$tdt[0]";
print" ������ $c1 ��������� ���� � $c2 �������� � �����
$adminmsg
|
";
// ���������� -=��� ��������=-
if (is_file("$datadir/usersdat.php")) { // ��������� ���� ������, ���� ��� �������
$userlines=file("$datadir/usersdat.php");
$usercount=count($userlines); $ui=$usercount-1; $t_people=""; $z_people=""; $s_people=""; $p_people=""; $s_p="0";
do {$udt=explode("|",$userlines[$ui]);
if (isset($udt[1])) {
$udt[5]=substr("$udt[5]",0, 10); // �������� ���� �������� �� �������
if (preg_match("(\d{2}\.\d{2}\.\d{4})",$udt[5])) { // ������������� ������� ��.��.����
$bday=substr("$udt[5]",0,-5);
$dmtoday=date("d.m");
$todaydt=explode(".",$dmtoday);
$codename=urlencode($udt[0]);
// �������� ��� �����������
if ($bday==$dmtoday) $t_people.="$udt[0], ";
$dt=explode(".",$udt[5]);
if ($dt[1]==12) $year=1972; else $year=1973; // ��� ����, ����� ����� ������� � ������� �� ������
$newdate=mktime(0,0,0,$dt[1],$dt[0],$year); // ��� ��� ��������
$tekdt=mktime(0,0,0,$todaydt[1],$todaydt[0],$year); // ������� ���� ��������� � ���� ������
$deystodate=round(($newdate-$tekdt)/86400); // ����� ������� ���� �������� �������
// �������� ��� ���������
if ($deystodate=="-1") $z_people.="$udt[0], ";
// �������� �������������� � ������ (������ 1 � ������ 7 ����)
if ($deystodate>1 and $deystodate<7) {if ($deystodate<10) $deystodate="0$deystodate"; $s_peo[$s_p]="$deystodate|$udt[0]|"; $s_p++;}
} // if ������ ���� ������� � ���������� $udt[5]
} // if iiset($udt[1])
$ui--; } while ($ui>0);
if (isset($s_peo)) {
usort($s_peo,"prcmp"); // ��������� ��� �� �����������
$i=0; do {$sdt=explode("|",$s_peo[$i]);
$sdt[0]=intval($sdt[0]); // ����������� ������ � �����, ����� ��������� 0 � ������
$codename=urlencode($sdt[1]);
$s_people.="$sdt[1] ($sdt[0] ��.), "; $i++;
} while ($i<$s_p); }
// �� ��� ������, ���� ���� �������� ���, ������ ��������
if (strlen($z_people)>1) $z_people="
�����: $z_people ����������� � ���� �������!
";
if (strlen($t_people)>1) $t_people="
�������: $t_people�������� ����������!
";
if (strlen($s_people)>1) $s_people="
�����: $s_people ������ ����� ���� �������!
";
if (strlen($z_people)>1 or strlen($t_people)>1 or strlen($s_people)>1){
print"
��� �������� |
 |
$z_people $t_people $s_people
|
";}
} // ����� ����� ��� ��������
// ���������� -= ��������� ��������� � ������ =-
if (is_file("$datadir/news.dat")) { $newmessfile="$datadir/news.dat";
$lines=file($newmessfile); $i=count($lines); //if ($i>10) $i=10; (������������� - ��� ��� ����!!! ;-))
if ($i>1) {
echo('
��������� ��������� |
 |
');
$a1=$i-1;$u="-1"; // ������� ������ �� ����������� ��� ��������
do {$dt=explode("|",$lines[$a1]); $a1--;
if (isset($dt[1])) { // ���� ������� ���������� � ������� (������ ������) - �� ������ � �� �������
$msg=htmlspecialchars($dt[6]);
$msg=str_replace("[b] "," ",$msg); $msg=str_replace("[/b]"," ",$msg);
$msg=str_replace("[RB] "," ",$msg); $msg=str_replace("[/RB]"," ",$msg);
$msg=str_replace("[Code] "," ",$msg); $msg=str_replace("[/Code]"," ",$msg);
$msg=str_replace("[Quote] "," ",$msg); $msg=str_replace("[/Quote]"," ",$msg);
$msg=str_replace(" ","\r\n", $msg);
$msg=str_replace("'","`",$msg);
$msg=str_replace("<br><br>","\r\n", $msg);
$dt[2]=str_replace(".201",".1", $dt[2]);
$dt[2]=substr($dt[2],0,8);
$dt[3]=substr($dt[3],0,5);
if ($dt[8]>$qq) $page=ceil($dt[8]/$qq); else $page=1; // ������� ��������
if ($page!=1) $pageadd="&page=$page"; else $pageadd="";
if ($dt[10]=="��") {$codename=urlencode($dt[4]); if (!isset($wrfname)) $name="$dt[4]"; else $name="$dt[4]";} else {$name="����� $dt[4]";}
print"$dt[2] - $dt[3]: $dt[9] -> $dt[5] - $name. ";
} // ���� ������� ����������
$a11=$u; $u11=$a1;
} while($a11 < $u11);
echo' |
';}
} // ����� ����� ��������� ���������
if (is_file("tubest.php")) include("tubest.php"); // ���������� ���� �: ������ 15-� ����� ����������� ��� � ������ 10 ����� �������� �������������
} // ����� if (statistika==TRUE)
if (is_file("$fskin/bottom.html")) include("$fskin/bottom.html"); // ���������� ������ ���� ������
} // if !isset($id) // ����� ������� ��������
if (isset($_GET['id'])) { $id=$_GET['id'];
// �������� � ������ ��������� �������
if (strlen($id)==3) { $fid=$id;
// ������
if (!ctype_digit($fid) or strlen($fid)>3) exit("$back. ����� ������� ������ ���� �������� � ��������� ����� 4 ��������");
$imax=count($mainlines); if (($fid>999) or (strlen($fid)==0)) exit("������ ������ ����� ��� �� ����������.");
// ��������� ������ ������ �������������� ��������
if (!isset($_GET['page'])) $page=1; else {$page=$_GET['page']; if (!ctype_digit($page)) $page=1; if ($page<1) $page=1;}
// �������� ������ �� ���-�� �¨�� �����. ���� ������ ���������� N � ���� ������� - �� ����������!
$maxzd=null;
do {$imax--; $ddt=explode("|", $mainlines[$imax]); if ($ddt[0]==$fid) $maxzd=$ddt[12]; } while($imax>"0");
if ($maxzd>=1) {
if (!ctype_digit($maxzd)) exit("$back ����� ����������� � ������. � � ����� ������ - ������!");
$noacsess="
������ � ������ ��������� |
��� ��������� ������� ������� ���������� ���� ������������������ � ����� ������� �� ����� $maxzd ����.";
// ���� ��������� ����� � ������ �����, ��������� ���-�� ��� ���� � ���������� � �������� � �������
if (isset($_COOKIE['wrfcookies'])) { // ���� ���� �������� ��� ������� ����
$text=$_COOKIE['wrfcookies'];
$text=replacer($text);
$wrfc=explode("|",$text); $wrfname=$wrfc[0]; if (isset($wrfc[1])) $wrfpass=$wrfc[1]; else exit("$back ������� ������ - � ���� ��� ������. ���� �� ����� ;-) ?");
// ��������� ���� � �������
$iu=$usercount; $ok=FALSE;
do {$iu--; $du=explode("|",$userlines[$iu]);
if (isset($du[1])) { $realname=strtolower($du[0]);
if (strtolower($wrfname)===$realname & $wrfpass===$du[1]) {$ok="$i"; if ($du[2]<$maxzd) exit("$noacsess � ��� ����� $du[2] ����.
$back
|
"); }}
} while($iu > "0");
} else exit("$noacsess
$back
"); // ���� ���� ���, �� ���� ���� ����� �� ��� �������, ����� - ��������
if ($ok!=FALSE) exit("$noacsess
$back
");
}
$addbutton="";
else $addbutton.="�������� �� ����������, �� ������������� �������� ������������ ���������� ��� � ���������!";
// ���������� ���� �� ���������� � ����� � �������
if (is_file("$datadir/topic$fid.dat")) {
$msglines=file("$datadir/topic$fid.dat"); $maxi=count($msglines); $i=$maxi;
if (isset($_POST['findme']) or isset($_GET['findme'])) {
// ���� ���� ������ �� �������� ����, ��:
// - ��������� ���� � ������ � �������� � ��������� ������ ������ ��, ������� �������� � �������� ������� �����
// - � $maxi ���������� ���-�� ���
// - � $msglines[$i] ���������� ������
setlocale(LC_ALL,'ru_RU.CP1251'); // ! ��������� ������ �������, ���������� � ���������� � � �������� �������
if (isset($_POST['findme'])) $findme=replacer($_POST['findme']);
if (isset($_GET['findme'])) { $findme=replacer($_GET['findme']); $findme=urldecode($findme);}
$stroka=strlen($findme); if($stroka<4 or $stroka>30) exit("����������� ����� � ���������� �� 4-� �� 30-� ��������!");
$tmplines=$msglines; $msglines=null; $i=0;
foreach($tmplines as $v) {$dt=explode("|", $v); if (stristr($dt[3],$findme)) {$msglines[$i]=$v; $i++;}}
$maxi=$i-1;} else $findme="";
$frname=str_replace(' ->','',$frname); //�������� ������ �������
print"";
if ($stop!=TRUE) $addbutton.=" |
";
if ($maxi>0) {
if ($maxi>$maxtem-1) $addbutton="
���� |
C�������� |
����� |
���������� |
\r\r\n";
} //if is_file
} while($lm < $fm);
// ��������� ���������� $pageinfo - �� ������� �������
if (strlen($findme)>1) $findadd="&findme=$findme"; else $findadd="";
$pageinfo=""; $addpage=""; $maxpage=ceil(($maxi+1)/$qqmain); if ($page>$maxpage) $page=$maxpage;
$pageinfo.="��������: ";
if ($page>3 and $maxpage>5) $pageinfo.="
1 ... ";
$f1=$page+2; $f2=abs($page-2); if ($f2=="0") $f2=1; if ($page>=$maxpage-1) $f1=$maxpage;
if ($maxpage<=5) {$f1=$maxpage; $f2=1;}
for($i=$f2; $i<=$f1; $i++) { if ($page==$i) $pageinfo.="
$i ";
else {if ($i!=1) $addpage="&page=$i"; $pageinfo.="
$i ";} }
if ($page<=$maxpage-3 and $maxpage>5) $pageinfo.="...
$maxpage";
$pageinfo.='
';
print"
$addbutton���������� ���������� ��� � ������� ���������.";
// ���� ����������: ��������� ������ ������ (�� ������� �������� ����� � �����)!
do {$i--; $dt=explode("|", $msglines[$i]);
$filename="$dt[7].dat"; if (is_file("$datadir/$filename")) $ftime=filemtime("$datadir/$filename"); else $ftime="";
$newlines[$i]="$ftime|$dt[7]|$i|";
} while($i > 0);
usort($newlines,"prcmp");
//print""; print_r($msglines); //exit;
// $newlines - ������ � �������: ���� | ���_�����_�_����� | � �/� |
// $msglines - ������ �� ����� ������ ��������� �������
$i=$maxi;
do {$i--; $dtn=explode("|", $newlines[$i]);
$numtp="$dtn[2]"; $lines[$i]="$msglines[$numtp]";
} while($i > 0);
// ����� ����� ����������
// ���������� QQmain ���
$fm=$maxi-$qqmain*($page-1);
if ($fm<"0") $fm=$qqmain; $lm=$fm-$qqmain; if ($lm<"0") $lm="0";
do {$fm--; $num=$fm+2;
$dt=explode("|", $lines[$fm]);
// ����� ��� ����������� ���� �� VIP-������
$dtn=explode("|", $newlines[$fm]);
$timer=time()-$dtn[0]; // ������ ������� ������ ������� (� ��������)
$filename=$dt[7];
if (is_file("$datadir/$filename.dat")) { // ���� ���� � ����� ���������� - �� �������� ���� � ������!
$msgsize=sizeof(file("$datadir/$filename.dat"));
// --------- �������� ����� ���������
$linetmp=file("$datadir/$filename.dat"); if (sizeof($linetmp)!=0) {
$pos=$msgsize-1; $dtt=explode("|", $linetmp[$pos]);
$foldicon="folder.gif";
// ���� ��������� ��������� � ������ ��������� ������ ��������� - ������ ������ ������ - �����
if (isset($wrfname)) {if (isset($dtt[9])) {if ($dtt[9]>$wrftime2) $foldicon="foldernew.gif";}}
if (strlen($dt[8])>1 and $dt[8]=="closed") {if ($msgsize<"20") $foldicon="close.gif"; else $foldicon="closed.gif";}} else $foldicon="foldernew.gif";
// --------- �����
print " |
 |
";
if ($timer<0) echo'VIP ';
$dt[3]=replacer($dt[3]);
print"$dt[3]";
if ($msgsize>$qq) { // ������� ������ ��������� ������� ����
$maxpaget=ceil($msgsize/$qq); $addpage="";
echo' ��������: ';
if ($maxpaget<=5) $f1=$maxpaget; else $f1=5;
for($i=1; $i<=$f1; $i++) {if ($i!=1) $addpage="&page=$i"; print" $i ";}
if ($maxpaget>5) print "... $maxpaget"; }
print" | $msgsize | ";
$codename=urlencode($dt[0]);
if ($dt[1]=="��") {
if (!isset($wrfname)) print "$dt[0]"; else print "$dt[0]";
print" $users"; } else print"$dt[0] $guest";
// ������ if (strlen...) ������ ���� ���� ���� � ����� ������ ������ - �������
if ($msgsize>=2) {$linesdat=file("$datadir/$filename.dat"); $dtdat=explode("|", $linesdat[$msgsize-1]);
if (strlen($linesdat[$msgsize-1])>10) {$dt[0]=$dtdat[0]; $dt[1]=$dtdat[1]; $dt[2]=$dtdat[2]; $dt[5]=$dtdat[5]; $dt[6]=$dtdat[6];}}
$dt[6]=substr($dt[6],0,-3);
if ($dt[5]===$date) $dt[5]="�������";
print " |
�����: $dt[0] ����/�����: $dt[5] � $dt[6] |
";
} else print"$addbutton";
} else print"$addbutton";
echo' |
';
if (isset($_GET['newtema'])) { if ($cangutema=="0" and !isset($wrfname)) print"������������� �������� ��������� ������ ����! ��� ����������� �������� �� ������: ������������������
"; else {
$maxzag=$maxzag-10; // ��� �����!!!
print"
$back
"); // ���� ���� ���, �� ���� ���� ����� �� ��� �������, ����� - ��������
if ($ok==FALSE) exit("$noacsess
$back
");
}
// ��������� ������ ������ �������������� ��������
if (!isset($_GET['page'])) $page=1; else {$page=$_GET['page']; if (!ctype_digit($page)) $page=1; if ($page<1) $page=1;}
$fm=$qq*($page-1); if ($fm>$maxi) $fm=$maxi-$qq;
$lm=$fm+$qq; if ($lm>$maxi) $lm=$maxi+1;
// ��������� ���������� $pageinfo - �� ������� �������
$pageinfo=""; $addpage=""; $maxpage=ceil(($maxi+1)/$qq); if ($page>$maxpage) $page=$maxpage;
$pageinfo.="��������: ";
if ($page>3 and $maxpage>5) $pageinfo.="
1 ... ";
$f1=$page+2; $f2=abs($page-2); if ($f2=="0") $f2=1; if ($page>=$maxpage-1) $f1=$maxpage;
if ($maxpage<=5) {$f1=$maxpage; $f2=1;}
for($i=$f2; $i<=$f1; $i++) { if ($page==$i) $pageinfo.="
$i ";
else {if ($i!=1) $addpage="&page=$i"; $pageinfo.="
$i ";} }
if ($page<=$maxpage-3 and $maxpage>5) $pageinfo.="...
$maxpage";
$pageinfo.='
';
$qm=null; $flag=0;
do {$dt=explode("|", replacer($lines[$fm]));
$youwr=null; $fm++; $num=$maxi-$fm+2; $status="";
if (strlen($lines[$fm-1])>5) { // ���� ������� ���������� � ������� (������ ������) - �� ������ � �� �������
if (isset($_GET['quotemsg'])) {$quotemsg=replacer($_GET['quotemsg']); if(ctype_digit($quotemsg) and $quotemsg==$fm) $qm="[Quote][b]$dt[0] �����:[/b]\r\n".$dt[4]."[/Quote]";}
$msg=str_replace("[b]","",$dt[4]);
$msg=str_replace("[/b]","", $msg);
$msg=str_replace("[RB]","", $msg);
$msg=str_replace("[/RB]","", $msg);
$msg=str_replace("<br>","
",$msg);
$msg=preg_replace("#\[Quote\]\s*(.*?)\s*\[/Quote\]#is","
������:",$msg);
$msg=preg_replace("#\[Code\]\s*(.*?)\s*\[/Code\]#is","
PHP ���:",$msg);
if ($antimat==TRUE) { // �������
$pattern="/\w{0,5}[�x]([�x\s\!@#\$%\^&*+-\|\/]{0,6})[�y]([�y\s\!@#\$%\^&*+-\|\/]{0,6})[�i�e�����]\w{0,7}|\w{0,6}[�p]([�p\s\!@#\$%\^&*+-\|\/]{0,6})[i��]([i��\s\!@#\$%\^&*+-\|\/]{0,6})[3��]([3��\s\!@#\$%\^&*+-\|\/]{0,6})[�d]\w{0,10}|[�cs][�y]([�y\!@#\$%\^&*+-\|\/]{0,6})[4�k�]\w{1,3}|\w{0,4}[b�]([b�\s\!@#\$%\^&*+-\|\/]{0,6})[l�]([l�\s\!@#\$%\^&*+-\|\/]{0,6})[y�]\w{0,10}|\w{0,8}[�][b�][����@e���a][���@���]\w{0,8}|\w{0,4}[�e]([�e\s\!@#\$%\^&*+-\|\/]{0,6})[�b]([�b\s\!@#\$%\^&*+-\|\/]{0,6})[u�]([u�\s\!@#\$%\^&*+-\|\/]{0,6})[�4�]\w{0,4}|\w{0,4}[�e�]([�e�\s\!@#\$%\^&*+-\|\/]{0,6})[�b]([�b\s\!@#\$%\^&*+-\|\/]{0,6})[�n]([�n\s\!@#\$%\^&*+-\|\/]{0,6})[�y]\w{0,4}|\w{0,4}[�e]([�e\s\!@#\$%\^&*+-\|\/]{0,6})[�b]([�b\s\!@#\$%\^&*+-\|\/]{0,6})[�o�a@]([�o�a@\s\!@#\$%\^&*+-\|\/]{0,6})[�n�t]\w{0,4}|\w{0,10}[�]([�\!@#\$%\^&*+-\|\/]{0,6})[�]\w{0,6}|\w{0,4}[p�]([p�\s\!@#\$%\^&*+-\|\/]{0,6})[�e�i]([�e�i\s\!@#\$%\^&*+-\|\/]{0,6})[�d]([�d\s\!@#\$%\^&*+-\|\/]{0,6})[o��a@�e�i]([o��a@�e�i\s\!@#\$%\^&*+-\|\/]{0,6})[�r]\w{0,12}/i";
$msg=preg_replace("$pattern","�������",$msg); }
if ($smile==TRUE) { // ��������
$i=count($smiles)-1; for($k=0; $k<$i; $k=$k+2)
{$j=$k+1; $msg=str_replace("$smiles[$j]","
",$msg);}}
// ���� ��������� ���������� �����
if ($liteurl==TRUE) $msg=preg_replace ("#([^\[img\]])(http|https|ftp|goper):\/\/([a-zA-Z0-9\.\?&=\;\-\/_]+)([\W\s<\[]+)#i", "\\1\\2://\\3\\4", $msg);
// ��������� ������ ����� ������ ������ URL!!!
$msg=preg_replace('#\[img\](.+?)\[/img\]#','
',$msg);
// ��������� � ������ ������ �� ������������
if ($dt[1]=="��") { $iu=$usercount; $predup="0";
do {$iu--; $du=explode("|", $userlines[$iu]); if ($du[0]==$dt[0])
{ if (isset($du[12])) {$status=$du[13]; $reiting=$du[2]; $youavatar=$du[12]; $email=$du[3]; $icq=$du[7]; $site=$du[8]; $userpn=$iu;}
if (isset($_COOKIE['wrfcookies'])) $youwr=preg_replace("#(\[url=([^\]]+)\](.*?)\[/url\])|(http://(www.)?[0-9a-z\.-]+\.[a-z]{2,6}[0-9a-z/\?=&\._-]*)#","$4 ",$du[11]); else $youwr=$du[11];}
} while($iu > "0");
}
if ($tblstyle=="row1") $tblstyle="row2"; else $tblstyle="row1";
if ($flag==FALSE) { // ���� �������� ���� ���
$frname=str_replace(' ->','',$frname); $frtname=str_replace(' ->','',$frtname); //�������� ������ �������
$flag=TRUE; print "
$pageinfo
";}
print"";
} // ���� ������� ����������
} while($fm < $lm);
print"
����� | ��������� |
";
// ���������: ��� �����?
if (!isset($youwr)) {if (strlen($dt[2])>5) print "$dt[0] "; else print"$dt[0] "; $kuda=$fm-1; print" ".chr(149)."
";
// ���� ����� ������, �������� ����� ��� �������� ��
if (strlen($dt[2])>5) print"
";
print"
$guest";}
else {
$codename=urlencode($dt[0]);
if (!isset($wrfname)) print"$dt[0]"; else print"$dt[0]";
print" ".chr(149)."
";
if (strlen($status)>2 & $dt[1]=="��" & isset($youwr)) print"$status"; else print"$users";
if (isset($reiting)) {if ($reiting>0) {echo' '; if (is_file("$fskin/star.gif")) {for ($ri=0;$ri<$reiting;$ri++) {print" ";} } }}
if (isset($youavatar)) { if (is_file("avatars/$youavatar")) $avpr="$youavatar"; else $avpr="noavatar.gif";
print "

";}
} // isset($youwr)
if (isset($youwr) and is_file("$datadir/userstat.dat")) { // ������ ��������� ����� ��� ���������! ;-)
if (isset($ulines[$userpn])) {
if (strlen($ulines[$userpn])>5) {
$ddu=explode("|",replacer($ulines[$userpn]));
$winop="window.open('tools.php?event=repa&name=$dt[0]&who=$userpn','repa','width=500,height=500,left=100,top=100')";
print"
"; }}}
print " |
$msg";
// ���� ����������� (���� ����� ���� �����������, �� �������)
if ($fm==1+$qq*($page-1) and is_file("$datadir/$id-vote.dat")) { // ���� �������� ���� ���
$vlines=file("$datadir/$id-vote.dat");
if (sizeof($vlines)>0) {$vitogo=count($vlines); $vi=1; $vdt=explode("|",$vlines[0]);
print" | ";
// ���� �������˨� ���� � ��������� - �� ���������� ������ � ������ �� ���� ��� ��������
if (isset($dt[12])) { if ($dt[12]!="" and is_file("$filedir/$dt[13]")) {
$fsize=round($dt[14]/10.24)/100; echo'"; }}
// �������� ������� ���������
if (isset($youwr)) { if (strlen($youwr)>3) print " | -------------------------------------------------- $youwr";}
// ���� ��� ���� �������� � ��� �����=����� � ��������� � ��������� ���������, �� ������� ������ ��������
$codename=urlencode($dt[0]);
if (isset($wrfname)) { if ($fm==($maxi+1) and strtolower($dt[0])==strtolower($wrfname)) print"";}
$addpage=""; if ($page>1) $addpage="&page=$page"; // ����� ��� �����������
print" |
|
��������� # $fm |
$dt[5] � $dt[6]
|
 |
$pageinfo";
if ($cangumsg==FALSE and !isset($wrfname)) {print"������������� �������� �������� ������ �� ���������! ��� ����������� �������� �� ������: ������������������
"; } else {
if ($closed==FALSE) {
if (isset($_COOKIE['wrfcookies'])) {$wrfc=$_COOKIE['wrfcookies']; $wrfc=htmlspecialchars($wrfc); $wrfc=stripslashes($wrfc); $wrfc=explode("|", $wrfc); $wrfpass=replacer($wrfc[1]);} else {unset($wrfpass); $wrfpass="";}
if ($stop==FALSE) {
print "