Файл: region_clean/forum/index.php
Строк: 1860
<?php
#######################################
## Mod By KoT (borispol) [76-75-072] ##
#######################################
require_once "../start.php";
require_once "../sid.php";
header('Cache-Control: no-store, no-cache, must-revalidate');
if ($ver == "wml") header ("Content-type:text/vnd.wap.wml; charset=utf-8");
else header("Content-Type:text/html; charset=UTF-8");
require_once "../inc.php";
$link = connect_db();
list($row, $id, $ps, $fsize1, $fsize2) = check_login($link);
require_once "../version.php";
if ($ver == "wml") {
echo $xml;
echo $dtd;
echo "<wml>n
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>n
<card id="change" title="Форум чата">n
<p>n";
} else {
echo "<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><link rel="stylesheet" type="text/css" href="../css/$css.css"/>
<title>Форум чата</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/></head><body>
<div align="left">";
}
$config_bookpost = 5;
$day = date("d.m.y");
$timer = date("H:i");
$id = $row['id'];
$r = mysql_query ("select `id`,`user`,`level`,`forumpost`,`sex`,`lastdate`,`gposts`,`posts`,`postlist` from `users` where `id`='".$id."';");
$arr = mysql_fetch_array($r);
$login = $arr['user'];
$usid = $arr['id'];
$issd = $_SESSION['id'];
$lev = $arr['level'];
$post = $arr['forumpost'];
$gp = $arr['gposts'];
$sex = $arr['sex'];
$lastdate = $arr['lastdate'];
$postsg = $arr['posts'];
$postlist = $arr['postlist'];
$realtimex = time();
$id = intval($id);
mysql_query("update `users` set `room`='forum',`onl`='".$realtimex."',`lastdate`='" . $realtimex . "' where `id`='" . $id . "'");
echo '<div class = "c4">Форум чата</div><br/>';
$otkl = mysql_fetch_array(mysql_query("SELECT * FROM `setting`"));
if ($otkl['forum'] == 1) {
echo 'Форум отключен Администратором!<br/>';
include_once '../foot.php';
exit;
}
function url_replace($m) {
if (!isset($m[3])) {
return '<a href="../link.php?&l=' . $m[1] . '">' . $m[2] . '</a>';
} else {
return '<a href="../link.php?&l=' . $m[3] . '">' . $m[3] . '</a>';
}
}
function bb_code($message) {
$message = preg_replace(array('#[code](.*?)[/code]#se'), array("''.highlight('$1').''"), str_replace("]n", "]", $message));
$message = preg_replace('#[b](.*?)[/b]#si', '<b>1</b>', $message);
$message = preg_replace('#[i](.*?)[/i]#si', '<i>1</i>', $message);
$message = preg_replace('#[u](.*?)[/u]#si', '<u>1</u>', $message);
$message = preg_replace('#[q](.*?)[/q]#si', '<div class="quote">1</div>', $message);
$message = preg_replace('#[small](.*?)[/small]#si', '<small>1</small>', $message);
$message = preg_replace('#[red](.*?)[/red]#si', '<font color="#FF0000">1</font>', $message);
$message = preg_replace('#[green](.*?)[/green]#si', '<font color="#00FF00">1</font>', $message);
$message = preg_replace('#[blue](.*?)[/blue]#si', '<font color="#0000FF">1</font>', $message);
$message = preg_replace('#[yellow](.*?)[/yellow]#si', '<font color="#FFFF00">1</font>', $message);
$message = preg_replace('#[del](.*?)[/del]#si', '<del>1</del>', $message);
$message = preg_replace_callback('~\[url=(http://.+?)\](.+?)\[/url\]|(http://(www.)?[0-9a-z.-]+.[a-z]{2,6}[0-9a-zA-Z/?.~&_=/%-:#]*)~', 'url_replace', $message);
return $message;
}
function highlight($code) {
$code = strtr($code,array("<"=>"<",">"=>">","`"=>"`","&"=>"&","$"=>"$","""=>""","'"=>"'","\"=>"\","%"=>"%","<br/>"=>"n","^"=>"^",":"=>":",'‘' => "'",'¦' => '|', '$$' => '$', 'I' => '|', "\"" => """));
$code = highlight_string($code,true);
$code = strtr($code,array("n"=>"<br>","<br/>"=>"<br>","$"=>"$","'"=>"'","\"=>"\","%"=>"%","^"=>"^",":"=>":", '<code>' => '', '</code>' => ''));
$code = '<span class="code"><span style="color: #000000">'.$code.'</span></span>';
return $code;
}
function notags($message) {
$message = strtr($message, array (
'[green]' => '',
'[/green]' => '',
'[red]' => '',
'[/red]' => '',
'[blue]' => '',
'[/blue]' => '',
'[b]' => '',
'[/b]' => '',
'[i]' => '',
'[/i]' => '',
'[u]' => '',
'[/u]' => '',
'[q]' => '',
'[/q]' => ''
));
return $message;
}
//------------------ Функция транслита букв --------------------//
function transliter($string) {
$trans1 = array("CSH","Csh","ZH","Zh","CH","Ch","SH","Sh","JO","Jo","JE","Je","JU","Ju","JA","Ja","csh","zh","ch","sh","jo","je","ju","ja","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","'","'","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","'","'","y");
$trans2 = array("Щ","Щ","Ж","Ж","Ч","Ч","Ш","Ш","Ё","Ё","Э","Э","Ю","Ю","Я","Я","щ","ж","ч","ш","ё","э","ю","я","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","ь","ь","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ь","ь","ы");
$string = str_replace($trans1,$trans2,$string);
return $string;
}
//--------------- Функция замены и вывода смайлов -------------------//
/*
function smiles($string) {
global $log;
$dir = opendir ("../smil");
while ($file = readdir ($dir)) {
if (ereg (".gif$", "$file")) {
$smfile[] = $file;
}
}
closedir ($dir);
rsort($smfile);
$countsm = count($smfile);
for($sm = 0; $sm < $countsm; $sm++) {
$file2 = str_replace(".gif","",$smfile[$sm]);
$string = str_replace(".$file2.",'<img src="../smil/'.$smfile[$sm].'" alt="."/>',$string);
$file3 = transliter($file2);
$string = str_replace(".$file3.",'<img src="../smil/'.$smfile[$sm].'" alt="."/>',$string);
}
return $string;
}
*/
function smiles($msg) {
$f_smiles = file("../smil/smiles.txt");
for ($i = 0; $i < count($f_smiles); $i++) {
$str_sm = explode(' ',trim($f_smiles[$i]));
$str_sm2 = '';
for ($z = 1; $z < count($str_sm); $z++) {
if ($z > 1) {
$str_sm2.=' ';
}
$str_sm2.=$str_sm[$z];
}
$str_sm2 = explode(',',$str_sm2);
for ($i2 = 0; $i2 < count($str_sm2); $i2++) {
$str_sm2[$i2] = stripcslashes(htmlspecialchars($str_sm2[$i2]));
$msg = str_replace("$str_sm2[$i2]", "<img src="../smil/$str_sm[0].gif" alt="" />", $msg);
}
}
return $msg;
}
/*
if ($ver == "wml") {
function myhtml($myhtml) {
$myhtml = str_replace("<div class='d'>","<br/>",$myhtml);
$myhtml = str_replace("<div class='e'>","<br/>",$myhtml);
$myhtml = str_replace("<div class='f'>","<br/>",$myhtml);
$myhtml = str_replace("</div>","<br/>",$myhtml);
$myhtml = str_replace("START_QUOTE","<small>",$myhtml);
$myhtml = str_replace("END_QUOTE","</small><br/>",$myhtml);
$myhtml = str_replace("<div class='fr'>","<br/>",$myhtml);
$myhtml = str_replace('<div class="fr">','<br/>',$myhtml);
return $myhtml;
}
ob_start(myhtml);
}
*/
if ($ver != "wml") {
function myhtml($myhtml) {
$myhtml = str_replace("START_QUOTE","<div class='quote'><br/>",$myhtml);
$myhtml = str_replace("END_QUOTE","</div>",$myhtml);
return $myhtml;
}
ob_start(myhtml);
}
if ($action == '') {
echo '<img src="../icon/logo3.png" alt="."/>';
if ($ver == "xhtml") echo '<div class="d1">';
echo '<a href="findyou.php?'.$ses.'&ref='.$ref.'">[Мои темы]</a><br/>
<a href="findend.php?'.$ses.'&ref='.$ref.'">[Активные темы]</a><br/>
<a href="index.php?'.$ses.'&action=sear&ref='.$ref.'">[Поиск по форуму]</a>';
if ($ver == "xhtml") echo '</div><br/>'; else echo '<br/>';
$q = mysql_query("select * from `forum` where type='r' order by realid");
while($mass = mysql_fetch_assoc($q))
{
$col2 = mysql_query("select * from `forum` where type='f' and refid='" . (int)$mass['id'] . "'");
$col12 = mysql_num_rows($col2);
$clm2 = 0;
while ($arr12 = mysql_fetch_assoc($col2))
{
$colmes2 = mysql_query("select id from `forum` where type='t' and refid='" . (int)$arr12['id'] . "'");
$colmes12 = mysql_num_rows($colmes2);
$clm2 = $clm2 + $colmes12;
}
$d = $i / 2;
$d1 = ceil($d);
$d2 = $d1 - $d;
$d3 = ceil($d2);
if ($d3 == 0)
{
$div = "<div class='d'>";
}
else
{
$div = "<div class='f'>";
}
$ri = mysql_query("select * from `forum` where type='r' and realid>'" . $mass['realid'] . "'");
$rei = mysql_num_rows($ri);
$ri1 = mysql_query("select * from `forum` where type='r' and realid<'" . $mass['realid'] . "'");
$rei1 = mysql_num_rows($ri1);
$count_f = mysql_num_rows(mysql_query("SELECT * FROM `forum` WHERE `refid`='".$mass['id']."' AND `type`='f'"));
echo $div."<a href='index.php?action=viewforum&fid=".$mass['id']."&".$ses."&ref=".$ref."'><b>".$mass['text']." </b></a>(".$count_f."/".$clm2.")</div>";
###################################
$qx = mysql_query("select * from `forum` where type='f' AND refid = '" . (int)$mass['id'] . "'");
while($massx = mysql_fetch_assoc($qx))
{
$col = mysql_query("select * from `forum` where type='t' and refid='" . (int)$massx['id'] . "'");
$col1 = mysql_num_rows($col);
$clm = 0;
while($arr1 = mysql_fetch_assoc($col))
{
$colmes = mysql_query("select id from `forum` where type='m' and refid='" . (int)$arr1['id'] . "'");
$colmes1 = mysql_num_rows($colmes);
$clm = $clm + $colmes1;
}
$d = $i / 2;
$d1 = ceil($d);
$d2 = $d1 - $d;
$d3 = ceil($d2);
$ri = mysql_query("select * from `forum` where type='r' and realid>'" . $massx['realid'] . "'");
$rei = mysql_num_rows($ri);
$ri1 = mysql_query("select * from `forum` where type='r' and realid<'" . $massx['realid'] . "'");
$rei1 = mysql_num_rows($ri1);
$dats = date("d.m.y/H:i",$massx['time']);
echo "<img src='../icon/004.png' alt='.'/> <a href='index.php?action=razdel&rid=".$massx['id']."&".$ses."&ref=".$ref."'><b>".$massx['text']."</b></a> ($col1/$clm)<br/>";
}
$massxxx = mysql_query("select * from `forum` where type='f' AND refid = '" . $mass['id'] . "' ORDER BY `time` DESC LIMIT 1");
while($massxx = mysql_fetch_assoc($massxxx)) {
$resultxd = mysql_query("SELECT `user` FROM `users` WHERE `id`='".(int)$massxx['from']."';");
$rowdx = mysql_fetch_array($resultxd);
$avtor = $rowdx[0];
$rs = mysql_query("SELECT `text` FROM `forum` WHERE `id`='".(int)$massxx['to']."';");
$rdd = mysql_fetch_array($rs);
$tema = $rdd[0];
echo "Раздел: <a href='index.php?action=razdel&rid=" . $massxx['id'] . "&$ses&ref=$ref'>".$massxx['text']."</a><br/>";
if (!empty($tema)) {
if (mb_strlen($tema, 'UTF8') >= 40) {
$tema = mb_substr($tema, 0, 40, 'UTF8');
echo "Тема: <a href="index.php?action=view&fid=".$massxx['to']."&$ses&ref=$ref">".$tema."...</a><br/>Посл.: ";
} else {
echo "Тема: <a href="index.php?action=view&fid=".$massxx['to']."&$ses&ref=$ref">".$tema."</a><br/>Посл.: ";
}
if (!empty($avtor)) {
echo "<a href="../info.php?$ses&nk=".$massxx['from']."&ref=$ref">".col_n($avtor)."</a>";
} else {
echo 'Юзер удален';
}
}
}
###################################
}
++$i;
$tttimedf = time();
$fpsdf = $tttimedf - 100;
$rdf = mysql_query("SELECT count(`id`) FROM `users` WHERE lastdate>='" . intval($fpsdf) . "';");
$cdf = mysql_fetch_row($rdf);
$count = $cdf[0];
echo '<hr/>';
$rt = mysql_query("SELECT count(`id`) FROM `forum` WHERE `type`='t';");
$tt = mysql_fetch_row($rt);
$ctt = $tt[0];
echo '<small>Создано тем: <b>'.$ctt.'</b></small><br/>';
$rt = mysql_query("SELECT count(`id`) FROM `forum` WHERE `type`='m';");
$tt = mysql_fetch_row($rt);
$ctt = $tt[0];
echo "<small>Написано постов: <b>".$ctt."</b></small><br/>";
if ($ver == "xhtml") echo '<br/><div class="d1">';
echo "<a href='index.php?$ses&action=online&ref=$ref'>Кто тут?(".$count.")</a>|<a href="index.php?".$ses."&action=statistic&ref=".$ref."">Статист.</a>|<a href="index.php?".$ses."&action=smiles&ref=".$ref."">Смайлы</a>|<a href="index.php?".$ses."&action=bb&ref=".$ref."">BB-Коды</a>";
if ($ver == "xhtml") echo '</div>'; else echo '<br/>';
}
if ($action == 'viewforum') {
$fid = intval($_GET['fid']);
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "r")
{
echo 'Ошибка!<br/><br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">В форум</a><br/>';
include_once '../foot.php';
exit;
}
echo 'Список подфорумов:<br/>';
$qx = mysql_query("select * from `forum` where type='f' AND refid = '" . $fid . "';");
if (mysql_num_rows($qx) == '') { echo '<br/>Пусто...<br/>'; }
while($massx = mysql_fetch_assoc($qx))
{
$col = mysql_query("select * from `forum` where type='t' and refid='" . (int)$massx['id'] . "';");
$col1 = mysql_num_rows($col);
$clm = 0;
while($arr1 = mysql_fetch_assoc($col))
{
$colmes = mysql_query("select id from `forum` where type='m' and refid='" . (int)$arr1['id'] . "' ;");
$colmes1 = mysql_num_rows($colmes);
$clm = $clm + $colmes1;
}
$d = $i / 2;
$d1 = ceil($d);
$d2 = $d1 - $d;
$d3 = ceil($d2);
if ($d3 == 0)
{
$div = "<div class='f'>";
}
else
{
$div = "<div class='e'>";
}
$ri = mysql_query("select * from `forum` where type='r' and realid>'" . $massx['realid'] . "';");
$rei = mysql_num_rows($ri);
$ri1 = mysql_query("select * from `forum` where type='r' and realid<'" . $massx['realid'] . "';");
$rei1 = mysql_num_rows($ri1);
$dats = date("d.m.y/H:i",$massx['time']);
$resultxd = mysql_query("SELECT `user` FROM `users` WHERE `id`='".(int)$massx['from']."';");
$rowdx = mysql_fetch_array($resultxd);
$avtor = $rowdx[0];
$rs = mysql_query("SELECT `text` FROM `forum` WHERE `id`='".(int)$massx['to']."';");
$rdd = mysql_fetch_array($rs);
$tema = $rdd[0];
echo $div."<img src="../icon/p2.png" alt="."/> <a href='index.php?action=razdel&rid=" . $massx['id'] . "&".$ses."&ref=".$ref."'><b>$massx[text]</b></a> ($col1/$clm)<br/><small>" . $massx['about'] . "</small>";
if (!empty($tema)) {
echo "<br/>--------<br/>Тема: <a href="index.php?action=view&fid=".$massx['to']."&".$ses."&ref=".$ref."">".$tema."</a><br/>Посл.: ";
if (!empty($avtor)) {
echo "<a href="../info.php?".$ses."&nk=".$massx['from']."&ref=".$ref."">".col_n($avtor)."</a>";
} else {
echo 'Юзер удален';
}
echo "($dats)";
}
echo '</div><br/>';
++$i;
}
}
if ($action == 'razdel') {
if (empty($_GET['rid']))
{
echo 'ID категории отсутствует!
<br/>
<br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">К управлению</a><br/>';
include_once '../foot.php';
exit;
}
$rid = intval($_GET['rid']);
$typ = mysql_query("select * from `forum` where id='".$rid."'");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "f" and $ms['type'] != "r")
{
echo 'Ошибка!<br/><br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">К управлению</a><br/>';
include_once '../foot.php';
exit;
}
echo "<div class='d1'>Все темы подфорума:</div><br/>
<img src='../icon/add.png' alt='x'/>
<a href='index.php?action=addtheme&fid=$rid&$ses&ref=$ref'>Создать тему</a><br/><br/>";
$qz = mysql_query("select `id` from `forum` where type='t' and refid='".$rid."'");
$coltem = mysql_num_rows($qz);
$ba = ceil($coltem/$postlist);
if (empty($_GET['p'])) $page = 1;
else $page = intval($_GET['p']);
$max_page = ceil($coltem/$postlist);
$page = ($page > $max_page) ? (($max_page == 0)? $page : $max_page) : $page;
$start = $postlist*($page-1);
$end = $postlist;
$start = $page * $postlist - $postlist;
$start = intval($start);
$postlist = intval($postlist);
$q = mysql_query("SELECT * FROM `forum` WHERE `type`='t' AND `refid`='".$rid."' ORDER BY `moder` DESC, `time` DESC LIMIT " . $start . ",".$postlist."");
$i++;
while($mass = mysql_fetch_assoc($q))
{
$xc = mysql_query("SELECT `from` FROM `forum` WHERE `type`='m' AND `refid`='".(int)$mass['id']."' ORDER BY `time` ASC LIMIT 1;");
$dc = mysql_fetch_array($xc);
$rxx = mysql_query("SELECT `user` FROM `users` WHERE `id`='".$dc['from']."'");
$rdd = mysql_fetch_array($rxx);
$avtor = $rdd[0];
$xcx = mysql_query("SELECT `from`,`time` FROM `forum` WHERE `type`='m' AND `refid`='".(int)$mass['id']."' ORDER BY `time` DESC LIMIT 1;");
$dcx = mysql_fetch_array($xcx);
$rxxx = mysql_query("SELECT `user` FROM `users` WHERE `id`='".(int)$dcx['from']."';");
$rddx = mysql_fetch_array($rxxx);
$avtorx = $rddx[0];
$last_time = date("d.m.y/H:i",$dcx[time]);
$colraz = mysql_query("select * from `forum` where type='m' and refid='".(int)$mass['id']."'");
$colraz1 = mysql_num_rows($colraz);
$gg++;
$d = $gg / 2;
$d1 = ceil($d);
$d2 = $d1 - $d;
$d3 = ceil($d2);
if ($d3 == 0)
{
$div = "<div class='f'>";
}
else
{
$div = "<div class='e'>";
}
$ri = mysql_query("select * from `forum` where type='f' and realid>'".$mass['realid']."'");
$rei = mysql_num_rows($ri);
$ri1 = mysql_query("select * from `forum` where type='f' and realid<'".$mass['realid']."'");
$rei1 = mysql_num_rows($ri1);
$dats = date("d.m.y/H:i", $mass['time']);
echo $div;
$pr_vote = mysql_fetch_assoc(mysql_query("SELECT `vopros` FROM `forum` WHERE `refid`='".(int)$mass['id']."'"));
$vorpos = $pr_vote['vopros'];
if ($mass['moder'] == 1) { echo "<img src='lock.gif' alt='.'/>"; }
if ($mass['close'] == 1) { echo "<img src='zakr.gif' alt='.'/>"; }
if ($mass['close'] == 0 and $mass['moder'] == 0 and $vorpos != '') { echo "<img src='vote.gif' alt='.'/>"; }
if ($mass['close'] == 0 and $mass['moder'] == 0 and $vorpos == '') { echo "<img src='forums.gif' alt='.'/>"; }
if ($mass['move'] == 1) { echo '(Перемещено)'; }
$result = mysql_query("SELECT count(`id`) FROM `forum` WHERE `type`='m' AND `refid`='".(int)$mass['id']."'");
$cntData = mysql_fetch_row($result);
$count_users = $cntData[0];
$max_pagex = ceil ($count_users/$postlist);
if ($max_pagex > 1)
{
$ba = ceil($count_users / $postlist);
$ba2 = $ba * $postlist - $postlist;
$asd = $start - ($postlist * 4);
$asd2 = $start + ($postlist * $postlist);
$i = $i + $postlist;
$GoGo = '<a href="index.php?action=view&fid='.$mass['id'].'&'.$ses.'&ref='.$ref.'&page='.$ba.'">>></a>';
}
echo " <a href='index.php?action=view&fid=" . $mass['id'] . "&".$ses."&ref=".$ref."'> ".$mass['text']."</a> (".$colraz1.") ".$GoGo."<br/>";
echo '</div>';
if (!empty($avtor)) {
echo "<a href="../info.php?".$ses."&nk=".$dc['from']."&ref=".$ref."">".col_n($avtor)."</a>";
} else {
echo 'Юзер удален';
}
echo '/';
if (!empty($avtorx)) {
echo "<a href="../info.php?".$ses."&nk=".$dcx['from']."&ref=".$ref."">".col_n($avtorx)."</a>";
} else {
echo 'Юзер удален';
}
echo " <small>($last_time)</small>";
++$i;
$PostTotal = mysql_num_rows(mysql_query("SELECT `attach` FROM `forum` WHERE `attach` AND `refid`='".(int)$mass['id']."'"));
if (!empty($PostTotal)) {
echo '<br/>Вложений: <a href="index.php?'.$ses.'&action=viewfile&fid='.$mass['id'].'">'.$PostTotal.'</a>';
}
}
if ($coltem == 0)
{
echo '<br/><center>Пока раздел пуст...</center><br/>';
}
if ($max_page > 1)
{
$ba = ceil($coltem/$postlist);
$ba2 = $ba*$postlist-$postlist;
$asd = $start-($postlist*4);
$asd2 = $start+($postlist*$postlist);
if ($asd < $coltem and $asd > 0) {
echo '<a href="index.php?action=razdel&rid='.$rid.'&p=1&'.$ses.'&ref='.$ref.'">1</a>...';
}
echo '<br/><br/>';
for($i = $asd; $i < $asd2;)
{
if ($i < $coltem and $i >= 0) {
$ii = floor(1+$i/$postlist);
if ($start == $i) {
echo '|<b>('.$ii.')</b>';
}
else
{
echo '|<a href="index.php?action=razdel&rid='.$rid.'&p='.$ii.'&'.$ses.'&ref='.$ref.'">'.$ii.'</a>';
}
}
$i = $i + $postlist;
}
if ($asd2 < $coltem) {
echo '...<a href="index.php?action=razdel&rid='.$rid.'&p='.$ba.'&'.$ses.'&ref='.$ref.'">'.$ba.'</a>';
}
}
echo '<br/>';
$tttimedf = time();
$fpsdf = $tttimedf - 100;
$rdf = mysql_query("SELECT count(`id`) FROM `users` WHERE lastdate>='" . intval($fpsdf) . "';");
$cdf = mysql_fetch_row($rdf);
$count = $cdf[0];
if ($ver == "xhtml") echo '<br/><div class="d1">';
echo "<a href='index.php?$ses&action=online&ref=$ref'>Кто тут?(".$count.")</a>|<a href="index.php?".$ses."&action=statistic&ref=".$ref."">Статист.</a>|<a href="index.php?".$ses."&action=smiles&ref=".$ref."">Смайлы</a>|<a href="index.php?".$ses."&action=bb&ref=".$ref."">BB-Коды</a>";
if ($ver == "xhtml") echo '</div>'; else echo '<br/>';
}
//---------------------------------------- РЕДАКТИРОВАНИЕ -------------------------------------------//
if ($action == 'viewfile') {
$fid = intval($fid);
$num = mysql_num_rows(mysql_query("SELECT `attach` FROM `forum` WHERE `attach` AND `refid`='$fid'"));
if (!isset($s)) $s = 0;
$mx = round(($num/10) + 0.45);
if ($s > $mx) $s = $mx;
if ($s == 0) $s = 1;
$ot = (($s - 1) * 10) + 1;
$do = $s * 10;
if ($do > $num) $do = $num;
$o = $ot - 1;
$n = $ot;
if ($do == 0) $n = $o;
if (mysql_affected_rows() == '') {
echo 'В этой теме нет вложений!<br/>';
include_once '../foot.php';
exit;
}
$o = intval($o);
$do = intval($do);
$r = mysql_query("SELECT `attach` FROM `forum` WHERE `refid`='$fid' ORDER BY `attach` DESC LIMIT $o,$do");
for ($i = $ot; $i <= $do; $i++) {
$arr = mysql_fetch_assoc($r);
echo '<a href="./files/'.$arr['attach'].'">'.$arr['attach'].'</a><br/>';
}
$next = $s + 1;
$prev = $s - 1;
if ($num > $do) {
$ot = (($next - 1) * 10) + 1;
$do = $next * 10;
if ($do > $num) $do = $num;
echo $fsize1;
echo '<br/><a href="index.php?'.$ses.'&action=viewfile&fid='.$fid.'&s='.$next.'">'.$ot.'-'.$do.' →</a><br/>';
echo $fsize2;
}
if ($s > 1) {
$ot = (($prev - 1) * 10) + 1;
$do = $prev * 10;
echo $fsize1;
echo '<br/><a href="index.php?'.$ses.'&action=viewfile&fid='.$fid.'&s='.$prev.'">← '.$ot.'-'.$do.'</a><br/>';
echo $fsize2;
}
}
if ($action == 'addtheme') {
if ($row['posts'] < 50) {
echo 'Создавать темы разрешено после <b>50</b> постов!<br/>';
include_once '../foot.php';
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "f")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$id = $row['id'];
$r = mysql_query ("select id,user,level from users where id='$id';");
$arr = mysql_fetch_array($r);
$login = $arr['user'];
$usid = $arr['id'];
$lev = $arr['level'];
echo 'Создание новой темы:<br/><br/>';
if ($ver != 'wml') {
echo '<form action="index.php?action=addthemego&fid='.$_GET['fid'].'&'.$ses.'&ref='.$ref.'" method="POST">
Заголовок темы:<br/>
<input name="names" value=""/><br/>
Сообщение:<br/>
<textarea cols="40" rows="5" name="about"></textarea><br/>
<input type="checkbox" name="vote" value="1"/>Голосование<br/>
<br/>
<input type="submit" class="ibutton" value="Отправить!">
</form>';
} else {
$ref = rand(0,999999);
echo '--------------------<br/>
Заголовок темы:<br/>
<input name="names'.$ref.'" value=""/><br/>
Сообщение:<br/>
<input name="about'.$ref.'" value=""/><br/>
Голосование:<br/>
<select name="vote">
<option value="2">Нет</option>
<option value="1">Да</option>
</select><br/>
<anchor>Отправить!
<go href="index.php?action=addthemego&fid='.$_GET["fid"].'&'.$ses.'&ref='.$ref.'" method="post">
<postfield name="names" value="$(names'.$ref.')"/>
<postfield name="about" value="$(about'.$ref.')"/>
<postfield name="vote" value="$(vote)"/>
</go></anchor><br/>--------------------<br/>';
}
}
//---------------------------------------- ИЗМЕНЕНИЕ СООБЩЕНИЯ -------------------------------------------//
if ($action == 'addthemego') {
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("SELECT * FROM `forum` WHERE `id`='".$fid."'");
$ms = mysql_fetch_array($typ);
if ($_POST['vote'] == 1) {
if ($ver == 'xhtml') {
echo '<form action="index.php?action=addthemego&fid='.$fid.'&'.$ses.'&ref='.$ref.'" method="POST">';
echo '<b>Добавление голосования</b>
<br/>
Вопрос:<br/>
<textarea cols="20" rows="3" name="vopros"></textarea>
<br/>
Вариант 1:
<br/>
<input type="text" name="v1"/>
<br/>
Вариант 2:
<br/>
<input type="text" name="v2"/>
<br/>
Вариант 3:
<br/>
<input type="text" name="v3"/>
<br/>
<br/>
<input type="hidden" name="about" value="'.$about.'"/>
<input type="hidden" name="names" value="'.$names.'"/>
<input type="hidden" name="pr" value="1"/>
<input type="submit" class="ibutton" name="sozd" value="Создать"><br/><br/>';
} else {
echo '<b>Добавление голосования</b>
<br/>
Вопрос:<br/>
<input type="text" name="vopros"/>
<br/>
Вариант 1:
<br/>
<input type="text" name="v1"/>
<br/>
Вариант 2:
<br/>
<input type="text" name="v2"/>
<br/>
Вариант 3:
<br/>
<input type="text" name="v3"/>
<br/>
<br/>
<anchor title="go">Создать<go href="index.php?action=addthemego&fid='.$fid.'&'.$ses.'&ref='.$ref.'" method="post">
<postfield name="names" value="'.$names.'"/>
<postfield name="about" value="'.$about.'"/>
<postfield name="vopros" value="$(vopros)"/>
<postfield name="v1" value="$(v1)"/>
<postfield name="v2" value="$(v2)"/>
<postfield name="v3" value="$(v3)"/>
<postfield name="pr" value="1"/>
</go></anchor><br/><br/>';
}
echo '<a href="index.php?action=addtheme&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">К форуму</a><br/>';
include_once '../foot.php';
exit;
}
if ($ms['type'] != "f")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$about = mysql_real_escape_string(check($about));
$names = mysql_real_escape_string(check($names));
$about = smiles($about);
$about = bb_code($about);
mysql_query ("SELECT `text` FROM `forum` WHERE `text`='".$names."' AND `type`='t'");
if (mysql_affected_rows() != 0) {
echo 'Ошибка! Такая тема уже существует.<br/><br/>';
include_once '../foot.php';
exit;
}
if (empty($_POST['names']))
{
echo 'Название темы отсутствует!<br/><br/>
<a href="index.php?action=addtheme&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">К форуму</a><br/>';
include_once '../foot.php';
exit;
}
if (empty($_POST['about']))
{
echo 'Сообщение отсутствует!<br/><br/>
<a href="index.php?action=addtheme&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">К форуму</a><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['pr'] == 1 and empty($vopros)) {
echo 'Не введен вопрос!<br/><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['pr'] == 1 and empty($v1)) {
echo 'Не введен вариант №1!<br/><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['pr'] == 1 and empty($v2)) {
echo 'Не введен вариант №2!<br/><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['pr'] == 1 and empty($v3)) {
echo 'Не введен вариант №3!<br/><br/>';
include_once '../foot.php';
exit;
}
$realtime = time();
$fid = intval($fid);
$id = intval($id);
$xid = intval($xid);
$login = mysql_real_escape_string(check($login));
$vopros = mysql_real_escape_string(check($vopros));
$v1 = mysql_real_escape_string(check($v1));
$v2 = mysql_real_escape_string(check($v2));
$v3 = mysql_real_escape_string(check($v3));
$vopros = substr(check($vopros),0,200);
$v1 = substr(check($v1),0,100);
$v2 = substr(check($v2),0,100);
$v3 = substr(check($v3),0,100);
if ($row['translit'] == 1) {
$vopros = trun_to_rus($vopros);
$v1 = trun_to_rus($v1);
$v2 = trun_to_rus($v2);
$v3 = trun_to_rus($v3);
}
mysql_query("insert into `forum` values(0,'$fid','t','".$realtime."','$id','','','','','".$names."','','','','','','','','','','','','','','','$id');");
$xid = mysql_insert_id();
mysql_query("insert into `forum` set `refid`='$xid', `type`='m', `time`='".$realtime."', `from`='$id', `ip`='0', `usnick`='".$login."', `text`='".$about."', `vopros`='".$vopros."', `v1`='".$v1."', `v2`='".$v2."', `v3`='".$v3."'");
mysql_query("update `forum` set `time`='".$realtime."', `from`='$id', `to`='$xid', where `id`='$fid'");
echo "Новая тема создана! <br/><a href='index.php?action=view&fid=$xid&$ses&ref=$ref'>К теме</a><br/>";
}
if ($action == 'vote') {
$v = intval($v);
$fid = intval($fid);
$id = intval($id);
if ($v < 1 or $v > 3) die();
mysql_query ("SELECT `vote`,`who` FROM `for_vote` WHERE `vote`='".$fid."' AND `who`='".$id."'");
if (mysql_affected_rows() == 0) {
$mid = intval($mid);
mysql_query("INSERT INTO `for_vote` SET `vote` = '".$fid."', `who` = '".$id."', `var` = '".$v."'");
echo 'Твой голос принят!<br/>';
} else {
echo 'Зачем дважды голосовать?<br/>';
}
}
if ($action == 'who_vote') {
$fid = intval($fid);
$v = intval($v);
$query = mysql_query("SELECT `who` FROM `for_vote` WHERE `vote`='".$fid."' AND `var`='".$v."'");
if (mysql_affected_rows() == 0) {
echo 'Ещё не голосовали!<br/>';
echo '<br/><a href="index.php?action=view&'.$ses.'&fid='.$fid.'">В тему</a><br/>';
include_once '../foot.php';
mysql_close($link);
exit;
} else {
echo 'Кто отдал голос:<br/>';
$i = 1;
while($arr = mysql_fetch_assoc($query)) {
$r = mysql_fetch_array(mysql_query ("SELECT `user` FROM `users` WHERE `id`='".intval($arr['who'])."' LIMIT 1"));
echo ($i++).') ';
if (!empty($r[0])) {
echo col_n($r[0]);
} else {
echo 'Юзер удален';
}
echo '<br/>';
}
echo '<br/><a href="index.php?action=view&'.$ses.'&fid='.$fid.'">В тему</a><br/>';
}
}
if ($action == 'sear') {
if ($ver != "wml") echo "<form method="POST" action="index.php?action=sview&$ses&ref=$ref" name="auth">n";
echo '<b>Введи название темы:</b><br/>
<input type="text" name="search"/><br/>
Транслит: <input type="checkbox" name="trun" value="1"/><br/>
<b>Искать в:</b><br/>
<select name="gde">
<option value="0">В постах</option>
<option value="1">В темах</option>
</select><br/>';
if ($ver == "wml") {
echo $fsize1;
echo "<anchor title="go">Найти<go href="index.php?action=sview&$ses&ref=$ref" method="post">
<postfield name="search" value="$(search)"/>
<postfield name="trun" value="$(trun)"/>
<postfield name="gde" value="$(gde)"/>
</go></anchor>";
echo $fsize2;
echo '<br/>';
} else {
echo '<br/><input type="submit" class="ibutton" value="Найти" name="enter"><br/>';
}
}
if ($action == 'sview') {
if ($_POST['trun'] == 1) {
$search = trun_to_rus($search);
}
$search = mysql_real_escape_string(check($search));
if ($_POST['gde'] == 0) {
$select = mysql_query("SELECT * FROM `forum` WHERE `type`='m' AND `text` LIKE '%".$search."%'");
if (mysql_affected_rows() == 0) {
echo 'Совпадений с <b>'.$search.'</b><br/> не найдено.<br/><br/>';
include_once '../foot.php';
exit;
}
echo 'Похожие результаты:<br/>';
while(false != ($inf = mysql_fetch_assoc($select))) {
echo '<a href="index.php?action=view&fid='.$inf['refid'].'&'.$ses.'&ref='.$ref.'">'.$inf['text'].'</a><br/>';
}
} elseif ($_POST['gde'] == 1) {
$select = mysql_query ("SELECT * FROM `forum` WHERE `type`='t' AND `text` LIKE '%".$search."%'");
if (mysql_affected_rows() == 0) {
echo 'Похожих тем на <b>'.$search.'</b><br/> не найдено.<br/><br/>';
include_once '../foot.php';
exit;
}
echo 'Похожие результаты:<br/>';
while(false != ($inf = mysql_fetch_assoc($select))) {
echo '<a href="index.php?action=view&fid='.$inf['id'].'&'.$ses.'&ref='.$ref.'">'.$inf['text'].'</a><br/>';
}
}
}
if ($action == 'view') {
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='".$fid."'");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($_GET['fid']);
$qz = mysql_query("select `id` from `forum` where type='m' and refid='$fid'");
$colmes = mysql_num_rows($qz);
$ba = ceil($colmes/$postlist);
if (empty($_GET['page']))
{
$page = 1;
}
else
{
$page = intval($_GET['page']);
}
if ($page < 1)
{
$page = 1;
}
if ($page > $ba)
{
$page = $ba;
}
$start = $page * $postlist - $postlist;
$start = intval($start);
$postlist = intval($postlist);
$q1 = mysql_query("SELECT * FROM `forum` WHERE type='m' AND refid='$fid' ORDER BY time LIMIT ".$start.",".$postlist.";");
$pages = $start + 1;
$r = mysql_query("select `text`,`refid` from `forum` where id='".$fid."'");
$arr = mysql_fetch_array($r);
$tema = $arr['text'];
$ref = $arr['refid'];
$rx = mysql_query("select `text`,`realid` from `forum` where id='".$ref."'");
$arrx = mysql_fetch_array($rx);
$razd = $arrx['text'];
echo "Раздел: <a href='index.php?action=razdel&rid=" . $ref . "&".$ses."&ref=".$ref."'>".$razd."</a><br/>Тема: <b>".$tema."</b><br/>Постов: ".$colmes."<br/>";
$count_th = mysql_result(mysql_query("SELECT `thank` FROM `forum` WHERE `id`='$fid'"), 0);
echo 'Сказали спасибо: '.$count_th.' чел.<br/>';
$typx = mysql_query("select * from `forum` where id='$fid'");
$msx = mysql_fetch_array($typx);
if ($msx['kedit'] >= 1)
{
$diz = $msx['tedit'];
$dizm = date("d.m/H:i", $diz);
$resultxd = mysql_query("SELECT `user` FROM `users` WHERE `id`='".(int)$msx['edit']."';");
$rowdx = mysql_fetch_array($resultxd);
$avtor = $rowdx[0];
if (!empty($avtor)) {
echo "<small>Тема изменена: ".col_n($avtor)." ($dizm)
Всего изм.:<b> ".$msx['kedit']."</b></small><br/>";
} else {
echo "<small>Тема изменена: ".$dizm."
Всего изм.:<b> ".$msx['kedit']."</b></small><br/>";
}
}
echo '<br/>';
$avtor_t = mysql_fetch_assoc(mysql_query("SELECT `avtor` FROM `forum` WHERE `avtor`='$id' AND `id`='$fid'"));
if ($avtor_t['avtor'] == $id and $msx['close'] != 1)
{
echo "<a href='index.php?action=close_my_theme&fid=" . $fid . "&".$ses."&ref=".$ref."'>[Закрыть тему]</a><br/>";
}
$pr_vote = mysql_fetch_assoc(mysql_query("SELECT `vopros`,`v1`,`v2`,`v3` FROM `forum` WHERE `refid`='".intval($fid)."'"));
$vorpos = $pr_vote['vopros'];
$v1 = $pr_vote['v1'];
$v2 = $pr_vote['v2'];
$v3 = $pr_vote['v3'];
if (!empty($vorpos)) {
$a = mysql_fetch_array(mysql_query("select count(klu4) as num from `for_vote` WHERE `vote`='".intval($fid)."' AND `var`='1'"));
$a1 = mysql_fetch_array(mysql_query("select count(klu4) as num from `for_vote` WHERE `vote`='".intval($fid)."' AND `var`='2'"));
$a2 = mysql_fetch_array(mysql_query("select count(klu4) as num from `for_vote` WHERE `vote`='".intval($fid)."' AND `var`='3'"));
$count_o = $a[0] + $a1[0] + $a2[0];
$proc1 = round($a[0] * 100 / $count_o);
$proc2 = round($a1[0] * 100 / $count_o);
$proc3 = round($a2[0] * 100 / $count_o);
echo '<div class="c4">Голосование
<br/>
Вопрос: '.$vorpos.'
<br/>';
if (!empty($v3) and $msx['close'] != 1) {
echo '1. <a href="index.php?'.$ses.'&action=vote&fid='.$fid.'&v=1">'.$v1.'</a>
<a href="index.php?'.$ses.'&action=who_vote&fid='.$fid.'&v=1">('.$a[0].')</a><br/>
<img src="grafic.php?rat='.$proc1.'" alt="."/>
<br/>';
} else {
echo '1. Вариант: '.$v1.'
('.$a[0].')<br/>
<img src="grafic.php?rat='.$proc1.'" alt="."/>
<br/>';
}
if (!empty($v2) and $msx['close'] != 1) {
echo '2. <a href="index.php?'.$ses.'&action=vote&fid='.$fid.'&v=2">'.$v2.'</a>
<a href="index.php?'.$ses.'&action=who_vote&fid='.$fid.'&v=2">('.$a1[0].')</a><br/>
<img src="grafic.php?rat='.$proc2.'" alt="."/>
<br/>';
} else {
echo '2. Вариант: '.$v2.'
('.$a[0].')
<br/>
<img src="grafic.php?rat='.$proc2.'" alt="."/>
<br/>';
}
if (!empty($v3) and $msx['close'] != 1) {
echo '3. <a href="index.php?'.$ses.'&action=vote&fid='.$fid.'&v=3">'.$v3.'</a>
<a href="index.php?'.$ses.'&action=who_vote&fid='.$fid.'&v=3">('.$a2[0].')</a><br/>
<img src="grafic.php?rat='.$proc3.'" alt="."/>
<br/>';
} else {
echo '3. Вариант: '.$v3.'
('.$a[0].')<br/>
<img src="grafic.php?rat='.$proc3.'" alt="."/>
<br/>';
}
echo '</div><br/>';
} elseif ($msx['close'] != 1 and empty($vopros) and $avtor_t['avtor'] == $id) {
echo '<a href="index.php?'.$ses.'&action=addvote&fid='.$fid.'">[Добавить голосование]</a><br/><br/>';
}
while($mass = mysql_fetch_assoc($q1))
{
if ($i >= 0 and $i < $colmes)
{
$d = $i / 2;
$d1 = ceil($d);
$d2 = $d1 - $d;
$d3 = ceil($d2);
if ($d3 == 0)
{
$div = "<div class='e'>";
}
else
{
$div = "<div class='f'>";
}
$uz = mysql_query("SELECT `id`, `sex`, `lastdate` FROM `users` WHERE `id`='" . (int)$mass['from'] . "';");
$mass1 = mysql_fetch_array($uz);
echo $div;
$rx = mysql_query ("select * from users where id='".(int)$mass['from']."';");
$arrx = mysql_fetch_array($rx);
$loginx = $arrx['user'];
$usidx = $arrx['id'];
$levx = $arrx['level'];
$lds = $arrx['lastdate'];
$fpsd = $arrx['forumpost'];
$sexx = $arrx['sex'];
$myavatar = $arrx['myavatar'];
if ($fpsd >= 0 and $fpsd < 50) {
$status = 'Пришелец';
}
if ($fpsd >= 50 and $fpsd < 100) {
$status = 'Землянин';
}
if ($fpsd >= 100 and $fpsd < 250) {
$status = 'Пацак';
}
if ($fpsd >= 250 and $fpsd < 500) {
$status = 'Чатланин';
}
if ($fpsd >= 500 and $fpsd < 800) {
$status = '<font color="#F3B520">Оранжевые штаны</font>';
}
if ($fpsd >= 800 and $fpsd < 1500) {
$status = '<font color="#FF3292">Малиновые штаны</font>';
}
if ($fpsd >= 1500 and $fpsd < 2500) {
$status = '<font color="#0000FF">Голубые штаны</font>';
}
if ($fpsd >= 2500 and $fpsd < 4000) {
$status = '<font color="#000000">Транклюкаторщик</font>';
}
if ($fpsd >= 4000 and $fpsd < 6000) {
$status = '<font color="#80867F">Эцилопп</font>';
}
if ($fpsd >= 6000) {
$status = '<font color="#FF0000">Господин ПЖ</font>';
}
$st = mysql_fetch_array(mysql_query("SELECT `id`,`podpis` FROM `users` WHERE `id`='".(int)$usidx."'"));
if (!empty($st['podpis']))
{
$status = '<font color="#FF0000">'.$st['podpis'].'</font>';
}
if (!empty($myavatar) and $row['myava'] == 0) {
echo '<img src="../fr4.php?usid='.$usidx.'" width="32" height="32"/> ';
} elseif (empty($myavatar) and $row['myava'] == 0) {
echo '<img src="../icon/noavatar.gif" width="32" height="32"/> ';
}
echo $pages++.'. ';
if (!empty($loginx)) {
echo "<a href="index.php?$ses&action=otv&nk=$mass[from]&fid=$fid"><b>".col_n($loginx)."</b></a>[$fpsd]";
} else {
echo '<b>Юзер удален</b>';
}
$vrp = $mass[time];
$vr = date("d.m.Y/H:i", $vrp);
$tfx = time();
$fpxx = $tfx - 100;
echo "<small><font color='" . $cdtim . "'>($vr)</font></small><br/>";
echo $status;
if ($lds >= intval($fpxx))
{
echo '<font color="#00AA00"> [ON] </font>';
}
else
{
echo '<font color="#FF0000"> [Off] </font>';
}
echo '</div>';
if (!empty($mass['to']))
{
echo $mass['to'] . ', ';
}
$tekst = $mass['text'];
if (mb_strlen($tekst, 'UTF8') >= 250 and strpos($tekst, '<span class="code">') === false and strpos($tekst, 'START_QUOTE') === false) {
$tekst = mb_substr($tekst, 0, 250, 'UTF8');
$open = substr_count($tekst, '<u>');
$closed = substr_count($tekst, '</u>');
$to_closed = $open - $closed;
if ($to_closed) $tekst = $tekst.str_repeat('</u>', $to_closed);
$open = substr_count($tekst, '<b>');
$closed = substr_count($tekst, '</b>');
$to_closed = $open - $closed;
if ($to_closed) $tekst = $tekst.str_repeat('</b>', $to_closed);
$open = substr_count($tekst, '<i>');
$closed = substr_count($tekst, '</i>');
$to_closed = $open - $closed;
if ($to_closed) $tekst = $tekst.str_repeat('</i>', $to_closed);
$open = substr_count($tekst, '<div class="quote">');
$closed = substr_count($tekst, '</div>');
$to_closed = $open - $closed;
if ($to_closed) $tekst = $tekst.str_repeat('</div>', $to_closed);
$open = substr_count($tekst, '<small>');
$closed = substr_count($tekst, '</small>');
$to_closed = $open - $closed;
if ($to_closed) $tekst = $tekst.str_repeat('</small>', $to_closed);
$open = substr_count($tekst, '<del>');
$closed = substr_count($tekst, '</del>');
$to_closed = $open - $closed;
if ($to_closed) $tekst = $tekst.str_repeat('</del>', $to_closed);
$open = substr_count($tekst, '<font color');
$closed = substr_count($tekst, '</font>');
$to_closed = $open - $closed;
if ($to_closed) $tekst = $tekst.str_repeat('</font>', $to_closed);
/*$tekst = preg_replace('#[a=(.*?)](.*?)([/a])?#si','<a href="1">2</a>', $tekst);
$tekst = str_replace('[/a]','', $tekst);*/
echo $tekst . '...';
echo '<br/><a href="index.php?'.$ses.'&action=read_m&idx='.$mass['id'].'&fid='.$fid.'">Читать все >></a><br/>';
} else {
echo $tekst . '<br/>';
}
if ($mass['kedit'] >= 1)
{
$diz = $mass['kedit'];
$dizm = date("d.m/H:i", $diz);
$resultxd = mysql_query("SELECT `user` FROM `users` WHERE `id`='".(int)$mass['edit']."';");
$rowdx = mysql_fetch_array($resultxd);
$avtor = $rowdx[0];
echo "<br/><small><font color='#999999'>Изменено: ".$mass['kedit']." </font>
".col_n($avtor)." <font color='#999999'>($dizm)</font>
</small>";
}
if (!empty($mass['attach']))
{
$fls = filesize("./files/$mass[attach]");
$fls = round($fls/1024,2);
echo "<br/><font color='#999999'><a href='index.php?action=load&fid=" . $mass['id'] . "&".$ses."&ref=".$ref."'>".$mass['attach']."</a> (".$fls." кб.)<br/>";
echo 'Скачано: '.$mass['dlcount'].' раз.</font>';
if ($lev >= 7)
{
echo "<br/><a href='index.php?action=del_attach&idx=".$mass['id']."&".$ses."&ref=".$ref."&fid=".$fid."'>[Удалить файл]</a>";
}
}
$lp = mysql_query("select `from`, `id` from `forum` where type='m' and refid='" . $fid . "' order by time desc LIMIT 1;");
$arr1 = mysql_fetch_array($lp);
$tpp = $realtime - 100;
echo '<br/>';
if ($lev >= 7)
{
echo "<a href='index.php?action=editpost&idx=".$mass['id']."&".$ses."&ref=".$ref."&fid=".$fid."'><small>[Изм]</small></a>";
}
$tttime = time();
$time_post = $mass[time];
$fps = $tttime-$time_post;
if ($mass['ip'] != 1)
{
echo "<a href='index.php?action=copy_post&idx=".$mass['id']."&".$ses."&ref=".$ref."&fid=".$fid."'><small>[Цит]</small></a>";
}
if ($mass['from'] == $id and $lev < 7 and $fps < 3600)
{
echo "<a href='index.php?action=edit_my_post&idx=".$mass['id']."&".$ses."&ref=".$ref."&fid=".$fid."'><small>[Изм]</small></a>";
}
if ($lev >= 7)
{
echo "<a href='index.php?action=delpost&idx=".$mass['id']."&".$ses."&ref=".$ref."&fid=".$fid."'><small>[Уд]</small></a><br/>";
}
}
++$i;
}
if ($type1['edit'] != 1 and $ms['close'] != 1)
{
if ($ver != "wml") {
echo "<div class='e'>Написать<br/><form action='index.php?action=say&fid=$fid&$ses&ref=$ref' method='post' enctype='multipart/form-data'><textarea cols='40' rows='5' title='Введи текст сообщения' name='msg'></textarea><br/>";
echo "<input type='checkbox' name='addfiles' value='1'/> Добавить файл<br/>";
if ($offtr != 1)
{
echo "<input type='checkbox' name='msgtrans' value='1'/> Транслит сообщения<br/>";
}
$sel_th = mysql_fetch_array(mysql_query("SELECT `thank` FROM `forum` WHERE `id`='$fid' AND `from`='$id'"));
if ($sel_th['thank'] == 0) {
echo "<input type='checkbox' name='thank' value='1'/> Сказать спасибо<br/>";
}
echo "<input type='submit' title='Нажми для отправки' name='submit' class='ibutton' value='Отправить'/></form><a href='index.php?action=save_theme&fid=" . $fid . "&".$ses."&ref=".$ref."'>[Скачать тему]</a><br/>";
echo '<a href="../myzakl.php?'.$ses.'&mod=for&z='.$fid.'">[В закладки]</a><br/>';
$num = mysql_num_rows(mysql_query("SELECT `namet` FROM `myzakl` WHERE `namet`='".intval($fid)."'"));
echo 'В закладках у: '.$num.' чел.</div>';
} else {
$ref = rand (0,999999);
echo '<br/>Написать:<br/>
<input name="msg'.$ref.'"/><br/>
Транслит
<select name="msgtrans">
<option value="0">Нет</option>
<option value="y">Да</option></select>
<br/>
<br/>
<anchor>Добавить!
<go href="index.php?action=say&fid=' . $fid . '&'.$ses.'&ref='.$ref.'" method="post">
<postfield name="msg" value="$(msg'.$ref.')"/>
<postfield name="msgtrans" value="$(msgtrans)"/>
<postfield name="user" value="$(user)"/>';
echo "</go></anchor><br/>--------------------<br/><a href='index.php?action=save_theme&fid=" . $fid . "&".$ses."&ref=".$ref."'>[Скачать тему]</a><br/>";
}
} else {
echo '<br/><b>Тема закрыта для обсуждения!</b><br/>';
}
if ($colmes > $postlist)
{
$ba = ceil($colmes/$postlist);
$ba2 = $ba*$postlist-$postlist;
$asd = $start-($postlist*4);
$asd2 = $start+($postlist*$postlist);
if ($asd < $colmes and $asd > 0) {
echo '<a href="index.php?action=view&fid='.$fid.'&page=1&'.$ses.'&ref='.$ref.'">1</a>...';
}
for($i = $asd; $i < $asd2;)
{
if ($i < $colmes and $i >= 0) {
$ii = floor(1+$i/$postlist);
if ($start == $i) {
echo '('.$ii.')|';
}
else
{
echo '<a href="index.php?action=view&fid='.$fid.'&page='.$ii.'&'.$ses.'&ref='.$ref.'">'.$ii.'</a>|';
}
}
$i = $i + $postlist;
}
if ($asd2 < $colmes) {
echo '...<a href="index.php?'.$ses.'&action=view&fid='.$fid.'&page='.$ba.'&ref='.$ref.'">'.$ba.'</a>';
}
echo "<form action='index.php?".$ses."&ref=".$ref."'>Перейти к странице:<br/>
<input type='hidden' name='fid' value='" . $fid ."'/>
<input type='hidden' name='action' value='view'/>
<input type='text' name='page' title='Введи номер страницы' value='".$page."'/><br/>
<input type='submit' title='Нажми для перехода' class='ibutton' value='Go!'/></form>";
}
if ($lev >= 7)
{
echo "<a href='index.php?action=edittheme&fid=" . $fid . "&".$ses."&ref=".$ref."'>Изменить</a>";
echo "|<a href='index.php?action=deltheme&fid=" . $fid . "&".$ses."&ref=".$ref."'>Удалить</a>|<a href='index.php?action=move_theme&fid=" . $fid . "&".$ses."&ref=".$ref."'>Перенести</a>";
}
if ($lev >= 7 and $ms['close'] != 1)
{
echo "|<a href='index.php?action=close_theme&fid=" . $fid . "&".$ses."&ref=".$ref."'>Закрыть тему</a>";
} elseif ($lev >= 7 and $ms['close'] != 0) {
echo "|<a href='index.php?action=open_theme&fid=" . $fid . "&".$ses."&ref=".$ref."'>Открыть тему</a>";
}
if ($lev >= 7 and $ms['moder'] != 1)
{
echo "|<a href='index.php?action=lock_theme&fid=" . $fid . "&".$ses."&ref=".$ref."'>Закрепить тему</a>";
} elseif ($lev >= 7 and $ms['moder'] != 0) {
echo "|<a href='index.php?action=unlock_theme&fid=" . $fid . "&".$ses."&ref=".$ref."'>Открепить тему</a>";
}
if ($ver == 'wml') echo '<br/>';
}
if ($action == 'addvote') {
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$avtor_t = mysql_fetch_assoc(mysql_query("SELECT `avtor` FROM `forum` WHERE `avtor`='$id' AND `id`='$fid'"));
if ($avtor_t['avtor'] != $id) {
echo 'Ошибка! Это не твоя тема.<br/><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>';
include_once '../foot.php';
exit;
}
$close = mysql_fetch_array(mysql_query("SELECT `close`,`vopros` FROM `forum` WHERE `id`='$fid'"));
if ($close['close'] == 1) {
echo 'Ошибка! Тема закрыта.<br/><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>';
include_once '../foot.php';
exit;
}
$pr_vote = mysql_fetch_assoc(mysql_query("SELECT `vopros` FROM `forum` WHERE `type`='t' AND `refid`='$fid'"));
$vorpos = $pr_vote['vopros'];
if (!empty($vorpos)) {
echo 'В этой теме уже есть голосование!<br/><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>';
include_once '../foot.php';
exit;
}
if ($ver == 'xhtml') {
echo '<form action="index.php?action=addvoteadd&fid='.$fid.'&'.$ses.'&ref='.$ref.'" method="POST">';
echo '<b>Добавление голосования</b>
<br/>
Вопрос:<br/>
<textarea cols="20" rows="3" name="vopros"></textarea>
<br/>
Вариант 1:
<br/>
<input type="text" name="v1"/>
<br/>
Вариант 2:
<br/>
<input type="text" name="v2"/>
<br/>
Вариант 3:
<br/>
<input type="text" name="v3"/>
<br/>
<br/>
<input type="hidden" name="pr" value="1"/>
<input type="submit" class="ibutton" name="sozd" value="Создать"><br/><br/>';
} else {
echo '<b>Добавление голосования</b>
<br/>
Вопрос:<br/>
<input type="text" name="vopros"/>
<br/>
Вариант 1:
<br/>
<input type="text" name="v1"/>
<br/>
Вариант 2:
<br/>
<input type="text" name="v2"/>
<br/>
Вариант 3:
<br/>
<input type="text" name="v3"/>
<br/>
<br/>
<anchor title="go">Создать<go href="index.php?action=addvoteadd&fid='.$fid.'&'.$ses.'&ref='.$ref.'" method="post">
<postfield name="vopros" value="$(vopros)"/>
<postfield name="v1" value="$(v1)"/>
<postfield name="v2" value="$(v2)"/>
<postfield name="v3" value="$(v3)"/>
<postfield name="pr" value="1"/>
</go></anchor><br/><br/>';
}
echo '<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>';
include_once '../foot.php';
exit;
}
if ($action == 'addvoteadd') {
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$pr_vote = mysql_fetch_assoc(mysql_query("SELECT `vopros` FROM `forum` WHERE `refid`='$fid'"));
$vorpos = $pr_vote['vopros'];
if (!empty($vorpos)) {
echo 'В этой теме уже есть голосование!<br/><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['pr'] == 1 and empty($vopros)) {
echo 'Не введен вопрос!<br/><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['pr'] == 1 and empty($v1)) {
echo 'Не введен вариант №1!<br/><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['pr'] == 1 and empty($v2)) {
echo 'Не введен вариант №2!<br/><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['pr'] == 1 and empty($v3)) {
echo 'Не введен вариант №3!<br/><br/>';
include_once '../foot.php';
exit;
}
$fid = intval($fid);
$vopros = mysql_real_escape_string(check($vopros));
$v1 = mysql_real_escape_string(check($v1));
$v2 = mysql_real_escape_string(check($v2));
$v3 = mysql_real_escape_string(check($v3));
$vopros = substr(check($vopros),0,200);
$v1 = substr(check($v1),0,100);
$v2 = substr(check($v2),0,100);
$v3 = substr(check($v3),0,100);
if ($row['translit'] == 1) {
$vopros = trun_to_rus($vopros);
$v1 = trun_to_rus($v1);
$v2 = trun_to_rus($v2);
$v3 = trun_to_rus($v3);
}
$go_vote = mysql_query("UPDATE `forum` SET `vopros`='".$vopros."', `v1`='".$v1."', `v2`='".$v2."', `v3`='".$v3."' WHERE `refid`='" . $fid . "'");
if (isset($go_vote)) {
echo 'Голосование добавлено!<br/><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>';
} else {
die('Произошла ошибка...');
}
}
if ($action == 'otv') {
$fid = intval($_GET['fid']);
$nk = intval($nk);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if ($row['posts'] < 50) {
echo 'Писать посты разрешено после <b>50</b> постов!<br/>';
include_once '../foot.php';
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['close'] == 1) {
echo 'Тема закрыта!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$SeUs = mysql_fetch_array(mysql_query("SELECT `user` FROM `users` WHERE `id`='".(int)$nk."'"));
if ($ver == "xhtml") {
echo "Ответить:<br/>
<form action='index.php?action=otv_ok&fid=$fid&$ses&nk=$nk' method='post'>
<textarea cols='40' rows='5' name='msg'>[b]".$SeUs['user']."[/b], </textarea><br/>
<br/>
<input type='submit' title='Нажми для отправки' name='submit' class='ibutton' value='Ответить'/><br/></form>";
} else {
echo 'Ответить:<br/><br/>
<input name="msg'.$ref.'" value="[b]'.$SeUs['user'].'[/b], "/><br/>
<anchor>Ответить
<go href="index.php?action=otv_ok&fid=' . $fid . '&'.$ses.'&nk='.$nk.'" method="post">
<postfield name="msg" value="$(msg'.$ref.')"/>
</go></anchor><br/>--------------------<br/>';
}
echo '<br/>
<div class="d1"><a href="../info.php?'.$ses.'&nk='.$nk.'">Анкета '.$SeUs['user'].'</a><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">В тему</a></div>';
}
if ($action == 'otv_ok') {
$fid = intval($_GET['fid']);
$nk = intval($nk);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if ($row['posts'] < 50) {
echo 'Писать посты разрешено после <b>50</b> постов!<br/>';
include_once '../foot.php';
exit;
}
$typ = mysql_query("SELECT * FROM `forum` WHERE id='".$fid."'");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" and $ms['close'] == 1)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if (empty($_POST['msg']))
{
echo 'Пост отсутствует!<br/><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">К форуму</a><br/>';
include_once '../foot.php';
exit;
}
$msg = trim($_POST['msg']);
$msg = mysql_real_escape_string(check($msg));
$realtime = time();
$msg = smiles($msg);
$msg = bb_code($msg);
$msg = preg_replace("|[rn]+|si","<br/>", $msg);
$fid = intval($fid);
$id = intval($id);
$xix = intval($xix);
$fpgp = intval($fpgp);
$fpst = intval($fpst);
mysql_query("insert into `forum` set `refid`='" . $fid . "', `type`='m', `time`='" . $realtime . "', `from`='" . $id . "', `ip`='0', `usnick`='".$login."', `text`='" . $msg . "';");
$fadd = mysql_insert_id();
mysql_query("update `forum` set `time`='" . $realtime . "', `from`='" . $id . "' where `id`='" . $fid . "';");
$rex = mysql_query("SELECT `refid` FROM `forum` WHERE `type`='t' AND `id`='".$fid."';");
$rx = mysql_fetch_array($rex);
$xix = $rx[0];
mysql_query("update `forum` set `time`='" . $realtime . "', `from`='" . $id . "', `to`='" . $fid . "' where `id`='" . $xix . "';");
$fpst = $post + 1;
$fpgp = $gp + 5;
mysql_query("update `users` set forumpost='" . $fpst . "', gposts='" . $fpgp . "' where id='" .$id . "';");
$pa = mysql_query("select * from `forum` where type='m' and refid= '" . $fid . "';");
$pa2 = mysql_num_rows($pa);
if ($upfp == 1)
{
$page = 1;
}
else
{
$page = ceil($pa2 / $postlist);
}
echo 'Ответ добавлен!<br/>
<br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">В тему</a><br/>';
}
if ($action == 'read_m') {
$q1 = mysql_fetch_array(mysql_query("SELECT * FROM `forum` WHERE type='m' AND `id`='".intval($idx)."'"));
echo $q1['text'] . '<br/>';
echo '<br/><a href="index.php?action=view&'.$ses.'&fid='.$fid.'">В тему</a><br/>';
}
if ($action == 'say') {
if ($row['posts'] < 50) {
echo 'Писать посты разрешено после <b>50</b> постов!<br/>';
include_once '../foot.php';
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" and $ms['close'] == 1)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if (empty($_POST['msg']))
{
echo 'Пост отсутствует!<br/><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">К форуму</a><br/>';
include_once '../foot.php';
exit;
}
$msg = trim($_POST['msg']);
$msg = mysql_real_escape_string(check($msg));
$login = mysql_real_escape_string(check($login));
if ($_POST['msgtrans'] == 1)
{
$msg = trun_to_rus($msg);
}
$realtime = time();
$msg = smiles($msg);
$msg = bb_code($msg);
$msg = preg_replace("|[rn]+|si","<br/>", $msg);
$fid = intval($fid);
$id = intval($id);
$xix = intval($xix);
$fpgp = intval($fpgp);
$fpst = intval($fpst);
mysql_query("INSERT INTO `forum` SET `refid`='".$fid."', `type`='m', `time`='".$realtime."', `from`='".$id."', `ip`='0', `usnick`='".$login."', `text`='".$msg."'");
$fadd = mysql_insert_id();
mysql_query("UPDATE `forum` SET `time`='".$realtime."', `from`='".$id."' WHERE `id`='".$fid."'");
$rex = mysql_query("SELECT `refid` FROM `forum` WHERE `type`='t' AND `id`='".$fid."'");
$rx = mysql_fetch_array($rex);
$xix = $rx[0];
mysql_query("UPDATE `forum` SET `time`='".$realtime."', `from`='".$id."', `to`='".$fid."' WHERE `id`='".(int)$xix."'");
$fpst = $post + 1;
$fpgp = $gp + 5;
mysql_query("UPDATE `users` SET `forumpost`='".(int)$fpst."', `gposts`='".(int)$fpgp."' WHERE `id`='".$id."'");
$sel_th = mysql_fetch_array(mysql_query("SELECT `thank` FROM `forum` WHERE `id`='$fid' AND `from`='$id'"));
if ($_POST['thank'] == 1 and $sel_th['thank'] == 0) {
mysql_query("UPDATE `forum` SET `thank`=`thank`+'1' WHERE `id`='$fid'");
}
$pa = mysql_query("SELECT * FROM `forum` WHERE `type`='m' AND `refid`='$fid'");
$pa2 = mysql_num_rows($pa);
if ($upfp == 1)
{
$page = 1;
}
else
{
$page = ceil($pa2/$postlist);
}
$addfiles = intval($_POST[addfiles]);
if ($_POST['addfiles'] == 1)
{
echo "Добавление файла (max. 2 mb)<br/><form action='index.php?action=addfile&fid=$fid&postx=$fadd&$ses&ref=$ref' method='post' enctype='multipart/form-data'>";
if (!eregi("Opera/8.01", $agent))
{
echo "<input type='file' name='fail'/><br/>";
}
else
{
echo "<input name='fail1' value =''/> <br/><a href='op:fileselect'>Выбрать файл</a><br/>";
}
echo "<input type='submit' title='Нажми для отправки' name='submit' class='ibutton' value='Отправить'/><br/></form>";
}
else
{
echo "Сообщение добавлено<br/><a href='index.php?action=view&fid=$fid&$ses&ref=$ref&page=$page'>Продолжить</a><br/>";
}
}
if ($action == 'copy_post') {
if ($row['posts'] < 50) {
echo 'Писать посты разрешено после <b>50</b> постов!<br/>';
include_once '../foot.php';
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='$fid'");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" or $ms['close'] == 1)
{
echo 'Нельзя процитировать данный пост или тема закрыта для обсуждений!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$idx = intval($_GET['idx']);
if (!is_numeric($idx) or empty($_GET['idx']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $idx . "'");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "m" or $ms['ip'] == 1)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$ms['text'] = htmlspecialchars($ms['text']);
if ($ver != "wml") {
echo "Цитировать пост:<br/><small>".$ms['text']."</small><br/>
<form action="index.php?action=say_copy&fid=" . $fid . "&idx=" . $idx . "&".$ses."&ref=".$ref."" method="post">
<textarea cols='40' rows='5' title="Введи текст сообщения" name="msg"></textarea><br/>
<input type='submit' title='Нажми для отправки' name='submit' class='ibutton' value='Цитировать'/><br/></form>";
} else {
$ref = rand(0,999999);
echo 'Цитировать пост:<br/><small>'.$ms['text'].'</small><br/>
<input name="msg'.$ref.'"/><br/>
Транслит<select name="msgtrans"><option value="0">Нет</option>
<option value="y">Да</option></select><br/>
<anchor>Цитировать!
<go href="index.php?action=say_copy&fid=' . $fid . '&idx=' . $idx . '&'.$ses.'&ref='.$ref.'" method="post">
<postfield name="msg" value="$(msg'.$ref.')"/>
<postfield name="msgtrans" value="$(msgtrans)"/>
</go></anchor><br/>--------------------<br/>';
}
}
if ($action == "say_copy") {
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" or $ms['close'] == 1)
{
echo 'Ошибка! Или тема закрыта!';
include_once '../foot.php';
ob_end_flush();
exit;
}
$msg = mysql_real_escape_string(check($_POST['msg']));
$msg = smiles($msg);
$msg = bb_code($msg);
$idx = intval($_GET['idx']);
if (!is_numeric($idx) or empty($_GET['idx']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $idx . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "m" or $ms['ip'] == 1)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if (empty($msg))
{
echo 'Пост отсутствует!<br/><br/>
<a href="index.php?action=view&fid='.$fid.'&'.$ses.'&ref='.$ref.'">Назад</a><br/>
<a href="index.php?'.$ses.'&ref='.$ref.'">К форуму</a><br/>';
include_once '../foot.php';
exit;
}
if ($_POST['msgtrans'] == 1)
{
$msg = trun_to_rus($msg);
}
$realtime = time();
$rxd = mysql_query ("select user from users where id='".(int)$ms['from']."';");
$arrxd = mysql_fetch_array($rxd);
$nick = $arrxd['user'];
$texts="START_QUOTE<b>".$nick."</b> пишет: <small>".$ms['text']."</small>END_QUOTE " . $msg;
$texts = preg_replace ("|[rn]+|si","<br/>", $texts);
$fid = intval($fid);
$id = intval($id);
$xix = intval($xix);
$fpst = intval($fpst);
$fpgp = intval($fpgp);
$login = mysql_real_escape_string(check($login));
$texts = mysql_real_escape_string($texts);
mysql_query("insert into `forum` set `refid`='" . $fid . "', `type`='m', `time`='" . $realtime . "', `from`='" . $id . "', `ip`='1', `usnick`='".$login."', `text`='" . $texts . "';");
$fadd = mysql_insert_id();
mysql_query("update `forum` set `time`='" . $realtime . "', `from`='" . $id . "' where `id`='" . $fid . "';");
$rex = mysql_query("SELECT `refid` FROM `forum` WHERE `type`='t' AND `id`='".$fid."';");
$rx = mysql_fetch_array($rex);
$xix = $rx[0];
mysql_query("update `forum` set `time`='" . $realtime . "', `from`='" . $id . "', `to`='" . $fid . "' where `id`='" . (int)$xix . "';");
$fpst = $post + 1;
$fpgp = $gp + 5;
mysql_query("update `users` set forumpost='" . (int)$fpst . "', gposts='" . (int)$fpgp . "' where id='" .$id . "';");
$pa = mysql_query("select * from `forum` where type='m' and refid= '" . (int)$fid . "';");
$pa2 = mysql_num_rows($pa);
if ($upfp == 1)
{
$page = 1;
}
else
{
$page = ceil($pa2 / $postlist);
}
echo "Сообщение добавлено<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=" . $page . "'>Продолжить</a><br/>";
}
if ($action == "delpost") {
if ($lev >= 7)
{
$idx = intval($_GET['idx']);
if (!is_numeric($idx) or empty($_GET['idx']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $idx . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "m")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typx = mysql_query("select * from `forum` where id='" . $fid . "';");
$msx = mysql_fetch_array($typx);
if ($msx['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if (empty($_GET['idx']))
{
echo 'ID поста отсутствует!<br/><br/>';
echo '<a href="index.php?'.$ses.'&ref='.$ref.'">К управлению</a><br/>';
include_once '../foot.php';
exit;
}
if ($ms['attach'] != '') {
unlink ("files/$ms[attach]");
echo 'Файл удален!<br/>';
}
mysql_query("delete from `forum` where `id`='" . (int)$idx . "';");
echo "Пост удален!<br/><br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/><br/>";
}
}
if ($action == 'editpost') {
if ($row['posts'] < 50) {
echo 'Писать посты разрешено после <b>50</b> постов чата!<br/>';
include_once '../foot.php';
exit;
}
if ($lev >= 7)
{
$idx = intval($_GET['idx']);
if (!is_numeric($idx) or empty($_GET['idx']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $idx . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "m")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typx = mysql_query("select * from `forum` where id='" . $fid . "';");
$msx = mysql_fetch_array($typx);
if ($msx['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if ($msx['close'] == 1) {
echo 'Тема закрыта!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if ($ver != "wml") {
echo "Изменить текст:<br/>
<small>".$ms['text']."</small>
<form action="index.php?action=edit_my_post_go&fid=$fid&$ses&ref=$ref&idx=$idx" method="post">
<textarea cols='40' rows='5' title="Введи текст сообщения" name="nf"></textarea><br/>
<input type="submit" name="submit" class="ibutton" value="Ok!"/><br/>
</form>";
} else {
$ref = mt_rand(0,999999);
echo 'Изменить текст:<br/>';
echo "<small>".$ms['text']."</small><br/>
<input name="nf".$ref."" value=""/><br/>";
echo '<anchor>OK
<go href="index.php?action=edit_my_post_go&fid='.$fid.'&'.$ses.'&ref='.$ref.'&idx='.$idx.'" method="post">
<postfield name="nf" value="$(nf'.$ref.')"/>
</go></anchor><br/>--------------------<br/>';
}
}
}
if ($action == 'editpostgo') {
if ($lev >= 7)
{
$idx = intval($_GET['idx']);
if (!is_numeric($idx) or empty($_GET['idx']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $idx . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "m")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
#$koled = $ms['kedit'] + 1;
$realtime = time();
$nf = mysql_real_escape_string(check($nf));
$nf = bb_code($nf);
$nf = smiles($nf);
$nf = preg_replace("|[rn]+|si","<br/>", $nf);
$id = intval($id);
#$koled = intval($koled);
$idx = intval($idx);
mysql_query("update `forum` set `text`='" . $nf . "', `tedit`='" . $realtime . "', `edit`='" . $id . "', `kedit`=`kedit`+'1' where `id`='" . (int)$idx . "';");
echo "Пост изменен!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
}
if ($action == 'addfile') {
function format($name)
{
$f1 = strrpos($name, ".");
$f2 = substr($name, $f1 + 1, 999);
$fname = strtolower($f2);
return $fname;
}
$fname = $_FILES['fail']['name'];
$fsize = $_FILES['fail']['size'];
if ($fname != "")
{
$tfl = strtolower(format($fname));
$df = array("vbs", "asp", "aspx", "shtml", "htd", "php", "php3", "php4", "php5", "phtml", "htt", "cfm", "tpl", "dtd", "hta", "pl", "js", "jsp");
if (in_array($tfl, $df))
{
echo 'Попытка отправить файл запрещенного типа!<br/><br/>';
include_once '../foot.php';
exit;
}
if ($fsize >= 1024 * 2048)
{
echo 'Вес файла превышает 2 MB - 2048KB !<br/>';
include_once '../foot.php';
exit;
}
if (eregi("[^a-z0-9.()+_-]", $fname))
{
echo 'В названии файла <b>'.$fname.'</b> присутствуют недопустимые символы<br/>Разрешены только латинские символы, цифры и некоторые знаки ( .()+_- )<br/>';
include_once '../foot.php';
exit;
}
if ((preg_match("/php/i", $fname)) or (preg_match("/.pl/i", $fname)) or ($fname == ".htaccess"))
{
echo 'Попытка отправить файл запрещенного типа!<br/><br/>';
include_once '../foot.php';
exit;
}
if (file_exists("files/$fname"))
{
$fname = "$realtime.$fname";
}
if ((move_uploaded_file($_FILES["fail"]["tmp_name"], "./files/$fname")) == true)
{
$ch = $fname;
@chmod("$ch", 0777);
@chmod("files/$ch", 0777);
echo 'Файл '.$ch.' успешно прикреплён!<br/>';
}
else
{
echo 'Ошибка при прикреплении файла!<br/>';
}
}
if (!empty($_POST['fail1']))
{
$uploaddir = "./files";
$uploadedfile = $_POST['fail1'];
if (strlen($uploadedfile) > 0)
{
$array = explode('file=', $uploadedfile);
$tmp_name = $array[0];
$filebase64 = $array[1];
}
$tfl = strtolower(format($tmp_name));
$df = array("asp", "aspx", "shtml", "htd", "php", "php3", "php4", "php5", "phtml", "htt", "cfm", "tpl", "dtd", "hta", "pl", "js", "jsp");
if (in_array($tfl, $df))
{
echo 'Попытка отправить файл запрещенного типа!<br/><br/>';
include_once '../foot.php';
exit;
}
if (strlen(base64_decode($filebase64)) >= 1024 * 2048)
{
echo 'Вес файла превышает 2 MB - 2048KB !<br/><br/>';
include_once '../foot.php';
exit;
}
if (eregi("[^a-z0-9.()+_-]", $tmp_name))
{
echo 'В названии файла <b>'.$tmp_name.'</b> присутствуют недопустимые символы<br/>Разрешены только латинские символы, цифры и некоторые знаки ( .()+_- )<br/><br/>';
include_once '../foot.php';
exit;
}
if ((preg_match("/php/i", $tmp_name)) or (preg_match("/.pl/i", $tmp_name)) or ($tmp_name == ".htaccess"))
{
echo 'Попытка отправить файл запрещенного типа!<br/><br/>';
include_once '../foot.php';
exit;
}
if (strlen($filebase64) > 0)
{
$fname = $tmp_name;
if (file_exists("files/$fname"))
{
$fname = "$realtime.$fname";
}
$FileName = "$uploaddir/$fname";
$filedata = base64_decode($filebase64);
$fid = @fopen($FileName, "wb");
if ($fid)
{
if (flock($fid, LOCK_EX))
{
fwrite($fid, $filedata);
flock($fid, LOCK_UN);
}
fclose($fid);
}
if (file_exists($FileName) and filesize($FileName) == strlen($filedata))
{
echo 'Файл '.$tmp_name.' успешно прикреплён!<br/>';
$ch = $fname;
} else
{
echo 'Ошибка при прикреплении файла '.$tmp_name.'!<br/>';
}
}
}
$postx = intval($postx);
$fid = intval($fid);
$fpst = intval($fpst);
$fpgp = intval($fpgp);
$id = intval($id);
mysql_query("update `forum` set attach='".$ch."' where id='".$postx."'");
$pa = mysql_query("select `id` from `forum` where type='m' and refid='$fid'");
$pa2 = mysql_num_rows($pa);
if ($upfp == 1)
{
$page = 1;
}
else
{
$page = ceil($pa2 / 10);
}
$fpst = $post + 1;
$fpgp = $gp + 5;
mysql_query("update `users` set forumpost='".(int)$fpst."', gposts='".(int)$fpgp."' where id='$id'");
echo "Сообщение добавлено<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=" . $page . "'>Продолжить</a><br/>";
}
if ($action == "load") {
function format($name)
{
$f1 = strrpos($name, ".");
$f2 = substr($name, $f1 + 1, 999);
$fname = strtolower($f2);
return $fname;
}
$fid = intval($_GET['fid']);
$fil = mysql_query("select * from `forum` where id='$fid'");
$mas = mysql_fetch_array($fil);
if (!empty($mas['attach']))
{
$tfl = strtolower(format(trim($mas['attach'])));
$df = array("asp", "aspx", "shtml", "htd", "php", "php3", "php4", "php5", "phtml", "htt", "cfm", "tpl", "dtd", "hta", "pl", "js", "jsp");
if (in_array($tfl, $df))
{
echo 'Ошибка!<br/>';
exit;
}
if (file_exists("./files/$mas[attach]"))
{
$dlcount = $mas['dlcount'] + 1;
$dlcount = intval($dlcount);
$fid = intval($fid);
mysql_query("update `forum` set `dlcount`='".$dlcount."' where id='$fid'");
echo "<a href='files/$mas[attach]'>Качать!</a><br/>";
}
}
else
{
echo 'Ошибка!<br/>';
}
}
if ($action == 'deltheme') {
if ($lev < 7) {
echo 'У тебя нет прав!<br/>';
include_once '../foot.php';
exit;
}
if ($lev >= 7)
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
mysql_query("DELETE `forum` WHERE `id`='".$fid."'");
mysql_query("DELETE FROM `for_vote` WHERE `vote`='".$fid."'");
echo "Тема удалена!<br/><a href='index.php?".$ses."&ref=".$ref."'>Продолжить</a><br/>";
$raz = mysql_query("select * from `forum` where refid='" . $fid . "' and type='m' ;");
while($raz1 = mysql_fetch_assoc($raz))
{
mysql_query("delete from `forum` where `id`='" . (int)$raz1['id'] . "';");
}
mysql_query("delete from `forum` where `id`='" . $fid . "';");
}
}
if ($action == 'edittheme') {
if ($lev < 7) {
echo 'У тебя нет прав!<br/>';
include_once '../foot.php';
exit;
}
if ($lev >= 7)
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typx = mysql_query("SELECT * FROM `forum` WHERE `id`='".$fid."';");
$msx = mysql_fetch_array($typx);
if ($msx['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$nf = htmlspecialchars($nf);
if ($ver != "wml") {
echo "Изменить тему:<br/>
<small>".$ms['text']."</small>
<form action="index.php?action=editthemego&fid=$fid&$ses&ref=$ref" method="post">
<textarea cols='40' rows='5' title="Введи текст сообщения" name="nf"></textarea><br/>
<input type="submit" name="submit" class="ibutton" value="Ok!"/><br/>
</form>";
} else {
$ref = mt_rand(0,999999);
echo 'Изменить тему:<br/>';
echo "<small>".$ms['text']."</small><br/>
<input name="nf".$ref."" value=""/><br/>";
echo '<anchor>OK
<go href="index.php?action=editthemego&fid='.$fid.'&'.$ses.'&ref='.$ref.'" method="post">
<postfield name="nf" value="$(nf'.$ref.')"/>
</go></anchor><br/>--------------------<br/>';
}
}
}
if ($action == 'editthemego') {
if ($lev >= 7)
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$koled = $ms['kedit'] + 1;
$realtime = time();
$nf = mysql_real_escape_string(check($nf));
$id = intval($id);
$fid = intval($fid);
$koled = intval($koled);
mysql_query("update `forum` set `text`='" . $nf . "', `tedit`='" . $realtime . "', `edit`='" . $id . "', `kedit`='" . $koled . "' where `id`='" . $fid . "';");
echo "Тема изменена!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
}
if ($action == 'close_theme') {
if ($lev < 7) {
echo 'У тебя нет прав!<br/>';
include_once '../foot.php';
exit;
}
if ($lev >= 7)
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='$fid'");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" or $ms['close'] == 1)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$msg = "Тема закрыта для обсуждения!";
$realtime = time();
$fid = intval($fid);
$id = intval($id);
$login = mysql_real_escape_string(check($login));
$msg = mysql_real_escape_string(check($msg));
mysql_query("update `forum` set `close`='1' where `id`='" . $fid . "';");
mysql_query("insert into `forum` set `refid`='" . $fid . "', `type`='m', `time`='" . $realtime . "', `from`='" . $id . "', `ip`='0', `usnick`='".$login."', `text`='" . $msg . "', `close`='1';");
echo "Тема закрыта!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
}
if ($action == 'close_my_theme') {
$realtime = time();
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='$fid'");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" or $ms['close'] == 1 or $ms['avtor'] != $id)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$msg = "Тема закрыта для обсуждения! [Автором темы]";
$fid = intval($fid);
$id = intval($id);
$login = mysql_real_escape_string(check($login));
$msg = mysql_real_escape_string(check($msg));
mysql_query("update `forum` set `close`='1' where `id`='" . $fid . "';");
mysql_query("insert into `forum` set `refid`='" . $fid . "', `type`='m', `time`='" . $realtime . "', `from`='" . $id . "', `ip`='0', `usnick`='".$login."', `text`='" . $msg . "', `close`='1'");
echo "Твоя тема закрыта!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
if ($action == 'open_theme') {
if ($lev < 7) {
echo 'У тебя нет прав!<br/>';
include_once '../foot.php';
exit;
}
if ($lev >= 7)
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" or $ms['close'] == 0)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($fid);
mysql_query("update `forum` set `close`='0' where `id`='" . $fid . "';");
mysql_query("delete from `forum` where `refid`='" . $fid . "' AND `type`='m' AND `close`='1';");
echo "Тема снова открыта!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
}
if ($action == "move_theme") {
if ($lev < 7) {
echo 'У тебя нет прав!<br/>';
include_once '../foot.php';
exit;
}
if ($lev >= 7 and $ver != "wml")
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if (empty($_GET['other']))
{
$rz = mysql_query("select * from `forum` where id='" . (int)$ms['refid'] . "';");
$rz1 = mysql_fetch_array($rz);
$other = $rz1[refid];
}
else
{
$other = intval($_GET['other']);
}
$raz = mysql_query("select * from `forum` where refid='" . (int)$other . "';");
$fr = mysql_query("select * from `forum` where id='" . (int)$other . "';");
$fr1 = mysql_fetch_array($fr);
if (!empty($_GET['other']))
{
echo "Перенос темы внутри подфорума $fr1[text]<br/>Выбери раздел:<br/>";
echo "<form action='index.php?action=move_theme_go&fid=".$fid."&".$ses."&ref=".$ref."' method='post'><select name='razd'>";
while($raz1 = mysql_fetch_assoc($raz))
{
if ($raz1['id'] != $ms['refid'])
{
echo "<option value='" . $raz1['id'] . "'>".$raz1['text']."</option>";
}
}
echo "</select><br/>
<input type='submit' name='submit' class='ibutton' value='Ok!'/></form>";
}
echo '<br/>Выбери категорию:<br/>';
$frm = mysql_query("select * from `forum` where type='r';");
while($frm1 = mysql_fetch_assoc($frm))
{
echo "<a href='index.php?action=move_theme&fid=".$fid."&".$ses."&ref=".$ref."&other=" . $frm1['id'] . "'>$frm1[text]</a><br/>";
}
echo '<br/>';
echo "</select><br/>
<input type='submit' name='submit' class='ibutton' value='Ok!'/></form>";
} else {
echo 'Доступно только для xHTML версии!';
}
}
if ($action == "move_theme_go") {
if ($lev >= 7)
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if (empty($_GET['fid'])) {
echo 'Отсутствует тема!';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t")
{
echo 'Ошибка темы!';
include_once '../foot.php';
ob_end_flush();
exit;
}
$razd = intval($_POST['razd']);
if (!is_numeric($razd))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if (empty($_POST['razd'])) {
echo 'Отсутствует раздел!'
;include_once '../foot.php';
ob_end_flush();
exit;
}
$typx = mysql_query("select * from `forum` where id='" . (int)$razd . "';");
$msx = mysql_fetch_array($typx);
if ($msx['type'] != "f")
{
echo 'Ошибка раздела!';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($fid);
$razd = intval($razd);
mysql_query("update `forum` set `refid`='".$razd."', `move`='1' where `id`='" . $fid . "';");
echo "Тема перемещена!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
}
if ($action == "lock_theme") {
if ($lev < 7) {
echo 'У тебя нет прав!<br/>';
include_once '../foot.php';
exit;
}
if ($lev >= 7)
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" || $ms[moder] == "1")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($fid);
mysql_query("update `forum` set `moder`='1' where `id`='" . $fid . "';");
echo "Тема закреплена!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
}
if ($action== "unlock_theme") {
if ($lev < 7) {
echo 'У тебя нет прав!<br/>';
include_once '../foot.php';
exit;
}
if ($lev >= 7)
{
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t" || $ms[moder] == "0")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($fid);
mysql_query("update `forum` set `moder`='0' where `id`='" . $fid . "';");
echo "Тема снова откреплена!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
}
if ($action == 'edit_my_post') {
$idx = intval($_GET['idx']);
if (!is_numeric($idx) or empty($_GET['idx']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $idx . "';");
$ms = mysql_fetch_array($typ);
$tttime = time();
$time_post = $ms['time'];
$fps = $tttime-$time_post;
if ($ms['type'] != "m" or $ms['from'] != "$id" or $fps>3600)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typx = mysql_query("select * from `forum` where id='" . $fid . "';");
$msx = mysql_fetch_array($typx);
if ($msx['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typs = mysql_query("select * from `forum` where id='" . $fid . "';");
$mss = mysql_fetch_array($typs);
if ($mss['close'] == 1) {
echo 'Тема закрыта!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
if ($ver != "wml") {
echo "Изменить текст:<br/>
<small>".$ms['text']."</small>
<form action="index.php?action=edit_my_post_go&fid=$fid&$ses&ref=$ref&idx=$idx" method="post">
<textarea cols='40' rows='5' title="Введи текст сообщения" name="nf"></textarea><br/>
<input type="submit" name="submit" class="ibutton" value="Ok!"/><br/>
</form>";
} else {
$ref = mt_rand(0,999999);
echo 'Изменить текст:<br/>';
echo "<small>".$ms['text']."</small><br/>
<input name="nf".$ref."" value=""/><br/>";
echo '<anchor>OK
<go href="index.php?action=edit_my_post_go&fid='.$fid.'&'.$ses.'&ref='.$ref.'&idx='.$idx.'" method="post">
<postfield name="nf" value="$(nf'.$ref.')"/>
</go></anchor><br/>--------------------<br/>';
}
}
if ($action == 'edit_my_post_go') {
$idx = intval($_GET['idx']);
if (!is_numeric($idx) or empty($_GET['idx']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $idx . "';");
$ms = mysql_fetch_array($typ);
$tttime = time();
$time_post = $ms['time'];
$fps = $tttime - $time_post;
if ($ms['type'] != "m" and $fps > 3600)
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $fid . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
#$koled = $ms['kedit'] + 1;
$realtime = time();
$nf = mysql_real_escape_string(check($nf));
$nf = bb_code($nf);
$nf = smiles($nf);
$nf = preg_replace ("|[rn]+|si","<br/>",$nf);
#$koled = intval($koled);
$id = intval($id);
mysql_query("update `forum` set `text`='" . $nf . "', `tedit`='" . $realtime . "', `edit`='" . $id . "', `kedit`=`kedit`+'1' where `id`='" . $idx . "';");
echo "Пост изменен!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
if ($action == 'del_attach') {
if ($lev >= 7)
{
$idx = intval($_GET['idx']);
if (!is_numeric($idx) or empty($_GET['idx']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * from `forum` where id='" . $idx . "';");
$ms = mysql_fetch_array($typ);
if ($ms['type'] != "m")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typx = mysql_query("select * from `forum` where id='" . $fid . "';");
$msx = mysql_fetch_array($typx);
if ($msx['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
unlink ("files/$ms[attach]");
$idx = intval($idx);
mysql_query("update `forum` set `attach`='', `dlcount`='0' where `id`='" . $idx . "';");
echo "Прикрепленный файл успешно удален!<br/><a href='index.php?action=view&fid=".$fid."&".$ses."&ref=".$ref."&page=1'>Продолжить</a><br/>";
}
}
if ($action == "online") {
$tttime = time();
$fps = $tttime - 100;
if (empty($_GET['p'])) $page = 1;
else $page=$_GET['p'];
$result = mysql_query("SELECT count(`id`) FROM `users` WHERE lastdate>='" . intval($fps) . "';");
$cntData = mysql_fetch_row($result);
$count_users = $cntData[0];
$max_page = ceil ($count_users / 5);
$page = ($page > $max_page) ? (($max_page == 0)? $page : $max_page) : $page;
$start = 5*($page-1);
$end = 5;
$resultx = mysql_query("SELECT `id`,`lastdate` FROM `users` WHERE lastdate>='" . intval($fps) . "' ORDER BY date DESC LIMIT $start,$end;");
$count_users_on_pagex = mysql_num_rows($resultx);
echo 'В онлайне сейчас: <b>' . $count_users . '</b> чел.<br/><br/>';
for($i = 0; $i < $count_users_on_pagex; $i++)
{
$row = mysql_fetch_array($resultx);
$xid = $row[0];
$lastdate = $row[1];
$dats = date("H:i",$lastdate);
$rs = mysql_query("SELECT * FROM `users` WHERE `id`='".(int)$xid."';");
$rowx = mysql_fetch_array($rs);
$usn = $rowx['user'];
$usidx = $rowx['id'];
$sexx = $rowx['sex'];
$mya = $rowx['myavatar'];
$birth = $rowx['birth'];
########################
$birth = explode("-",$birth);
$d = $birth[0];
$m = $birth[1];
$g = $birth[2];
if ($d != NULL and $m != NULL and $g != NULL) {
if ($m == 1);
elseif ($m == 2);
elseif ($m == 3);
elseif ($m == 4);
elseif ($m == 5);
elseif ($m == 6);
elseif ($m == 7);
elseif ($m == 8);
elseif ($m == 9);
elseif ($m == 10);
elseif ($m == 11);
elseif ($m == 12);
$birth = date("Y")-$g;
if (date("n") < $m) $birth = $birth-1;
elseif (date("n") == $m and date("j") < $d) $birth = $birth-1;
}
########################
if ($sexx == 'М') {
echo '<img src="../icon/1.png" alt="x"/>
<a href="../info.php?'.$ses.'&nk='.$xid.'&ref='.$ref.'"><b>'.col_n($usn).'</b></a> ('.$sexx.'/'.$birth.') '.$dats.'<br/>';
} else {
echo '<img src="../icon/0.png" alt="x"/>
<a href="../info.php?'.$ses.'&nk='.$xid.'&ref='.$ref.'"><b>'.col_n($usn).'</b></a> ('.$sexx.'/'.$birth.') '.$dats.'<br/>';
}
}
echo '<br/>';
if ($i == 0)
{
echo '<br/><center><b>В онлайне пусто</b></center><br/>';
}
if ($max_page > 1)
{
$ba=ceil($count_users/5);
$ba2=$ba*5-5;
echo 'Страницы:';
$asd=$start-(5*4);
$asd2=$start+(5*5);
if($asd<$count_users && $asd>0){echo ' <a href="index.php?action=online&p=1&'.$ses.'&ref='.$ref.'">1</a> ... ';}
for($i=$asd; $i<$asd2;)
{
if ($i<$count_users && $i>=0) {
$ii=floor(1+$i/5);
if ($start == $i) {
echo ' <b>('.$ii.')</b>';
}
else
{
echo ' <a href="index.php?action=online&p='.$ii.'&'.$ses.'&ref='.$ref.'">'.$ii.'</a>';
}
}
$i=$i+5;
}
if ($asd2<$count_users) {
echo ' ... <a href="index.php?action=online&p='.$ba.'&'.$ses.'&ref='.$ref.'">'.$ba.'</a>';
}
}
}
if ($action == "save_theme") {
$fid = intval($_GET['fid']);
if (!is_numeric($fid) or empty($_GET['fid']))
{
echo 'Попытка взлома! Я тебя запомнил <font color="#FF0000">'.$_SERVER['REMOTE_ADDR'].'</font><br/>';
echo '<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a><br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$typ = mysql_query("select * FROM `forum` where id='" . $fid . "';");
$type1 = mysql_fetch_array($typ);
if ($type1['type'] != "t")
{
echo 'Ошибка!<br/>';
include_once '../foot.php';
ob_end_flush();
exit;
}
$delf = opendir("temtemp");
while ($tt = readdir($delf))
{
if ($tt != "." and $tt != ".." and $tt != "index.php")
{
$tm[] = $tt;
}
}
closedir($delf);
$totalt = count($tm);
for ($it = 0; $it < $totalt; $it++)
{
$filtime[$it] = filemtime("temtemp/$tm[$it]");
$tim = time();
$ftime1 = $tim - 100;
if ($filtime[$it] < $ftime1)
{
unlink("temtemp/$tm[$it]");
}
}
$tema = mysql_query("select * FROM `forum` where type='m' and refid= '" . $fid . "' order by time;");
$text = "$type1[text]rn";
while($arr = mysql_fetch_assoc($tema))
{
$arr['text'] = str_replace("START_QUOTE", "Цитата:{", $arr['text']);
$arr['text'] = str_replace("END_QUOTE", "}-Ответ:", $arr['text']);
$arr['text'] = str_replace(""", """, $arr['text']);
$arr['text'] = str_replace("<b>", "", $arr['text']);
$arr['text'] = str_replace("</b>", "", $arr['text']);
$arr['text'] = str_replace("<br/>", "", $arr['text']);
$arr['text'] = str_replace("<small>", "''", $arr['text']);
$arr['text'] = str_replace("</small>", "''", $arr['text']);
if (!empty($arr['to']))
{
$stroka = "$arr[usnick](" . date("d.m.Y/H:i", $arr[time]) . ")-$arr[to], $arr[text]rn";
}
else
{
$stroka = "$arr[usnick](" . date("d.m.Y/H:i", $arr[time]) . ")-$arr[text]rn";
}
$text = "$text$stroka";
}
$realtime = time();
$num = "$realtime$fid";
$fp = fopen("temtemp/$num.txt", "a+");
flock($fp, LOCK_EX);
fputs($fp, "$textrn");
fflush($fp);
flock($fp, LOCK_UN);
fclose($fp);
@chmod("$fp", 0777);
@chmod("temtemp/$num.txt", 0777);
echo "<a href='temtemp/$num.txt'>Скачать</a><br/>Ссылка активна 5 минут!<br/>";
}
if ($action == "statistic") {
$rt = mysql_query("SELECT count(`id`) FROM `forum` WHERE `type`='t';");
$tt = mysql_fetch_row($rt);
$ctt = $tt[0];
echo 'Создано тем: <b>'.$ctt.'</b><br/>';
$rt = mysql_query("SELECT count(`id`) FROM `forum` WHERE `type`='m';");
$tt = mysql_fetch_row($rt);
$ctt = $tt[0];
echo 'Написано постов: <b>'.$ctt.'</b><br/>';
$rt = mysql_query("SELECT count(`id`) FROM `forum` WHERE `attach`!='';");
$tt = mysql_fetch_row($rt);
$ctt = $tt[0];
echo 'Выложено файлов: <b>'.$ctt.'</b><br/>';
$rt = mysql_query("SELECT sum(`dlcount`) FROM `forum`;");
$tt = mysql_fetch_row($rt);
$ctt = $tt[0];
echo 'Кол-во скачиваний: <b>'.$ctt.'</b><br/>';
$rt = mysql_query("SELECT sum(`kedit`) FROM `forum`;");
$tt = mysql_fetch_row($rt);
$ctt = $tt[0];
echo 'Отредактировано тем и постов: <b>'.$ctt.'</b><br/>';
$rt = mysql_query("SELECT sum(`moder`) FROM `forum`;");
$tt = mysql_fetch_row($rt);
$ctt = $tt[0];
echo 'Важных тем: <b>'.$ctt.'</b><br/><br/>';
}
if ($action == "smiles") {
$config_smilelist = 10;
echo '<b>Смайлы:</b><br/><br/>';
$dir = opendir ("../smil");
while ($file = readdir ($dir))
{
if (preg_match("/.gif$/i", $file))
{
$a[] = $file;
}
}
closedir ($dir);
sort($a);
$total = count($a);
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $config_smilelist)
{
$end = $total;
}
else
{
$end = $start + $config_smilelist;
}
for ($i = $start; $i < $end; $i++)
{
$smkod = str_replace(".gif","",$a[$i]);
echo '<img src="../smil/'.$a[$i].'" alt="."/>';
echo '<br/>.'.$smkod.'.<br/>';
}
echo '<br/>';
# постраничный вывод
if ($start != 0) {
echo '<a href="index.php?action=smiles&'.$ses.'&ref='.$ref.'&start='.($start - $config_smilelist).'"><-Назад </a> ';
} else {
echo '<-Назад ';
}
echo '|';
if ($total > $start + $config_smilelist) {
echo ' <a href="index.php?action=smiles&'.$ses.'&ref='.$ref.'&start='.($start + $config_smilelist).'"> Далее-></a>';
} else {
echo ' Далее->';
}
$a = count($a);
$ba = ceil($a/$config_smilelist);
$ba2 = floor(($a-1)/$config_smilelist)*$config_smilelist;
echo '<br/><br/>Страницы:';
$asd = $start-($config_smilelist*4);
$asd2 = $start+($config_smilelist*5);
if ($asd < $a and $asd > 0) {
echo ' <a href="index.php?action=smiles&'.$ses.'&ref='.$ref.'&start=0">1</a> ... ';
}
for($i = $asd; $i < $asd2;)
{
if ($i < $a and $i >= 0) {
$ii=floor(1+$i/$config_smilelist);
if ($start == $i) {
echo ' <b>'.$ii.'</b>';
}
else
{
echo ' <a href="index.php?action=smiles&'.$ses.'&ref='.$ref.'&start='.$i.'">'.$ii.'</a>';
}
}
$i = $i + $config_smilelist;
}
if ($asd2 < $a) {
echo ' ... <a href="index.php?action=smiles&'.$ses.'&ref='.$ref.'&start='.$ba2.'">'.$ba.'</a>';
}
echo '<br/><br/>Всего доступно cмайлов: '.(int)$total.'<br/>';
}
if ($action == "bb") {
echo '<div align = "left"><b>Справка по тегам</b>
<br/>Ты можешь выражать свой текст следующими тегами:<br/><br/>
[b]<b>Жирный шрифт</b>[/b]<br/>
[i]<i>Наклонный шрифт</i>[/i]<br/>
[u]<u>Подчеркнутый шрифт</u>[/u]<br/>
[q]<div class="quote">Для вставки цитат</div>[/q]<br/>
[small]<small>Мелкий шрифт</small>[/small]<br/>
[del]<del>Зачеркнутый шрифт</del>[/del]<br/>
[red]<font color="red">Красный цвет</font>[/red]<br/>
[green]<font color="green">Зеленый цвет</font>[/green]<br/>
[blue]<font color="blue">Синий цвет</font>[/blue]<br/>
[yellow]<font color="yellow">Желтый цвет</font>[/yellow]<br/><br/>
[code]'.bb_code("[code]<? echo 'Для вставки php-кода'; ?>[/code]").'[/code]<br/><br/>
Для того чтобы вставить ссылку можно просто написать http://адрес_cсылки<br/>
Для ссылки с названием: [url=http://адрес_cсылки] Название [/url]</div><br/><br/>';
}
if ($ver != "wml") { echo '<br/><div class="d1">'; }
echo '<a href="index.php?'.$ses.'&ref='.$ref.'">В форум</a><br/>
<a href="../enter.php?'.$ses.'&ref='.$ref.'">В прихожую</a>';
if ($ver != "wml") { echo '</div>'; }
if ($ver == "wml") {
echo '<br/><small>© ' . $url . '</small><br/>';
}
if ($ver == "xhtml") {
echo '<small>© ' . $url . '</small><br/>
<div class = "d2">[WML|xHTML]</div>';
}
if ($ver == "wml") echo "</p></card></wml>";
else echo "</div></body></html>";
mysql_close ($link);
?>