Вход Регистрация
Файл: include/newtt.php
Строк: 288
<?
if(!$authorize AND $AuthorAnonim)
{
$f intval($_GET['f']);
@
$back mysql_fetch_assoc(mysql_query("SELECT name, id FROM `forums` WHERE id=".$f));
$ip = empty($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['REMOTE_ADDR'] : $_SERVER['HTTP_X_FORWARDED_FOR'] ;
$ip htmlspecialchars(addslashes($ip));
$user htmlspecialchars(sql($_SERVER['HTTP_USER_AGENT']));
    if(!
mysql_result(mysql_query("SELECT COUNT(*) FROM forums WHERE id=".$f), 0))
    {
        if(
$version == "wml")
            {
                
header('Content-type: text/vnd.wap.wml; charset=utf-8');
                
header("Cache-Control: no-cache");
                echo(
doctype("Ошибка").$tag.'
Ошибка! Подфорума не существует! <br />
<a href="./?p=0&amp;v=wml">Форумы</a>
'
.$tagC.'</p></card></wml>');
            } elseif(
$version == "xhtml")
                {
                    
header("Content-type: text/html; charset=utf-8");
                    
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
   
header("Cache-Control: no-cache, must-relative");
                    echo(
'<html>
<head>
<title>Ошибка</title>
</head>
<body bgcolor="'
.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'
.$style['title'].'">
<font color="#FFFFFF"><b>Ошибка</b></font>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Ошибка! Подфорума не существует! '.$tagC.' </td></tr>
<tr bgcolor="'
.$style['bottom'].'"><td>'.$tag.'
<a href="./?p=0&amp;v=xhtml">Форумы</a>
'
.$tagC.'</td></tr></table>
</body></html>'
);
                }
    } elseif(
ban($user$ip))
    {
            if(
$version == "wml")
            {
                
header('Content-type: text/vnd.wap.wml; charset=utf-8');
                
header("Cache-Control: no-cache");
                echo(
doctype("Ошибка").$tag.'
Ошибка! Вы заблокированы модератором '
.$modername.'. <br />
Причина: '
.$banmess.'! <br />
-
<a href="'
.$_SERVER['HTTP_REFERER'].'">Назад</a><br />
<a href="./?p=0&amp;v=wml">Форумы</a>
'
.$tagC.'</p></card></wml>');
            } elseif(
$version == "xhtml")
                {
                    
header("Content-type: text/html; charset=utf-8");
                    
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
   
header("Cache-Control: no-cache, must-relative");
                    echo(
'<html>
<head>
<title>Ошибка</title>
</head>
<body bgcolor="'
.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr align="center" bgcolor="'
.$style['title'].'"><td colspan="2">
<font color="#FFFFFF"><b>Ошибка</b></font>
<tr bgcolor="'
.$style['text'].'"><td colspan="2">'.$tag.'Вы заблокированы модератором '.$modername.'</td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Причина:'.$tagC.'</td><td>'.$tag.$banmess.$tagC.'</td></tr>
<tr bgcolor="'
.$style['bottom'].'"><td colspan="2">'.$tag.'
<a href="./?p=0&amp;v=xhtml">Форумы</a>
'
.$tagC.'</td></tr></table>
</body></html>'
);
                }
    } else
    {
        if(empty(
$_POST['nt']))
        {
            
$r "";
                 for(
$i=0$i<strlen($username); $i++)
                {
                    
$r .= "_";
                }
            if(
$version == "wml")
            {
                
header("Content-type: text/vnd.wap.wml; charset=utf-8");
                
header("Cache-Control: no-cache");
                echo(
doctype("Новая тема").$tag.'
<b>Добавить тему в "'
.$back['name'].'"</b><br /> <br />
Имя: <input type="text" name="author" maxlength="10" /><br />
Тема: '
.$tagC.'<br />
<input type="text" name="topic'
.$ref.'" /><br />
'
.$tag.'Сообщение:'.$tagC.' <br />
<input type="text" name="mess'
.$ref.'" maxlength="600" /><br />');
echo(
$tag.'Транслит: '.$tagC.'<br />
<select name="transl'
.$ref.'">
<option value="0">Нет</option>
<option value="1">Да</option>
</select><br />
<img src="./img.php?rnd='
.$ref.'" alt="" /><br />
<a href="./?p=31&amp;v=wml&amp;f='
.$f.'&amp;rnd='.$ref.'">[Обновить код]</a><br />
Введите число на картинке сверху: <input type="text" name="code" value="" maxlength="5" size="5" /><br />'
);
echo(
'<anchor>[Добавить]
<go href="./?p=31&amp;v=wml&amp;f='
.$f.'&amp;rnd='.$ref.'" method="post">
<postfield name="mess" value="$(mess'
.$ref.')" />
<postfield name="topic" value="$(topic'
.$ref.')" />
<postfield name="transl" value="$(transl'
.$ref.')" />
<postfield name="code" value="$(code'
.$ref.')" />
<postfield name="nt" value="1" />
</go></anchor><br />
'
.$tag.'-
<a href="./?p=14&amp;v=wml&amp;f=4">Смайлы</a><br />
<a href="./?p=2&amp;v=wml&amp;f='
.$f.'">Назад в  «'.$back['name'].'»</a><br />
'
.$tagC.'</p></card></wml>');
            } elseif(
$version == "xhtml")
            {
                
header("Content-type: text/html; charset=utf-8");
                
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
   
header("Cache-Control: no-cache, must-relative");
                echo(
'<html>
<head>
<title>Новая тема</title>
</head>
<body bgcolor="'
.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<form action="./?p=31&amp;v=xhtml&amp;f='
.$f.'&amp;rnd='.$ref.'" method="post">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'
.$style['title'].'" colspan="2">
<font color="#FFFFFF"><b>Новая тема</b></font>
</td></tr>
<tr bgcolor="'
.$style['bottom'].'"><td colspan="2"><b>'.$tag.'Добавить тему в "'.$back['name'].'"'.$tagC.'</b></td></tr>
<tr bgcolor="#deebf1"><td colspan="2"></td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Имя:'.$tagC.'</td><td><input type="text" name="author" maxlength="10" /></td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Тема:'.$tagC.'</td><td><input type="text" name="topic"></td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Сообщение:'.$tagC.'</td><td><textarea name="mess" cols="30" rows="5"></textarea></td></tr>');
echo(
'<tr bgcolor="'.$style['text'].'"><td nowrap>'.$tag.'Транслит:'.$tagC.'</td>
<td><select name="transl">
<option value="0">Нет</option>
<option value="1">Да</option>
</select></td></tr>
<tr bgcolor="'
.$style['text'].'"><td></td><td><img src="./img.php?rnd='.$ref.'" alt="" /><br />
<a href="./?p=31&amp;v=xhtml&amp;f='
.$f.'&amp;rnd='.$ref.'">[Обновить код]</a></td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Введите число на картинке сверху:'.$tagC.'</td><td><input type="text" name="code" value="" maxlength="5" size="5" /><br /></td></tr>
<tr bgcolor="'
.$style['text'].'"><td align="center" colspan="2">
<input type="hidden" name="nt" value="1">
<input type="submit" value="Добавить" /></td></tr>
<tr bgcolor="'
.$style['bottom'].'"><td colspan="2"> '.$tag.'
<a href="./?p=14&amp;v=xhtml&amp;f=4">Смайлы</a><br />
<a href="./?p=2&amp;v=xhtml&amp;f='
.$back['id'].'">Назад в «'.$back['name'].'»</a><br />
'
.$tagC.'</td></tr></table>
</form>
</body></html>'
);
                }
        } else
        {
            
$error "";
            
$topic $_POST['topic'];
            
$transl sql(trim(htmlspecialchars(chop($_POST['transl']))));
            
$username sql(trim(htmlspecialchars(chop($_POST['author']))));
            
$code file_get_contents("./codes/".$_GET['rnd'].".txt");
            
$_POST['code'] = htmlspecialchars($_POST['code']);
            if(
$transl == "1")
              {
                  
$topic translate($topic);
                  
$message translate($message);
              }
              
$topic cutString($topic256);
            
$topic sql(trim(htmlspecialchars(chop($topic))));
            
$topic preg_replace("|[rn]+|""rn"$topic);
             
$topic preg_replace("|[n]+|""n"$topic);
              
$message $_POST['mess'];
            
$message preg_replace("|[rn]+|"" rn"$message);
             
$message preg_replace("|[n]+|""n"$message);
            
$message sql(htmlspecialchars(trim(chop(cutString($message1024)))));
            
$message preg_replace_callback("|&lt;(d{1,20})&gt;|""smile"$message);
                
$sesss mysql_query("SELECT * FROM `users` WHERE `username`='".$username."'");
                
$sesRR mysql_fetch_array($sesss);
                
$upd $sesRR['upd'];
                
$rz time() - $upd;
                if(!
preg_match("|^[<>@[] -._0-9a-zA-Zа-яА-Я]+$|u"$username) or strlen($username) > 20)
                {
                    
$error .= "Ошибка!!! Поле "Имя" пустое или содержит плохие символы <br />";
                }
                if(empty(
$topic))
                {
                    
$error .= "Ошибка!!! Поле "Тема" не заполнено <br />";
                } if(!
preg_match("|^[-a-z0-9а-яё_!?№#;:%^&*()+=~|\/ @.,[]{}"'<>]*$|iu", $topic))
                {
                    $error .= "Ошибка!!! Тема содержит плохие символы <br />";
                } if(empty($message))
                {
                    $error .= "Ошибка!!! Поле "Сообщение" не заполнено <br />";
                } if(!preg_match("|^[-a-z0-9а-яё_!?№#;:%^&*()+=~|\/ @.,[]{}"'
<>s]*$|iu", $message))
                {
                    
$error .= "Ошибка!!! Сообщение содержит плохие символы <br />";
                } if(empty(
$_POST['code']) or $_POST['code'] != $code)
                {
                    
$error .= "Ошибка!!! Неверно введен код из 5ти цифр с картинки<br />";
                }
                if(strpos(
$message, "http://") !== false)
                
{
                    
$message preg_replace("|(http://[^s]+)|i""<a href="go/?\1">\1</a>"$message);
                }
                else if(
strpos($message"HTTP://") !== false)
                {
                    
$message preg_replace("|(HTTP://[^s]+)|i""<a href="go/?\1">\1</a>"$message);
                } 
                if(
mysql_result(mysql_query("SELECT COUNT(*) FROM `users` WHERE username='".$username."'"), 0) > 0)
                {
                    
$error .= "Ошибка!!! Для использования этого имени необходима авторизация <br />";
                }
if (
$rz <= 3600) {
                    
$error .= "Не стоит создавать столько тем! <br />";
                }
            if(!empty(
$error))
            {
            
unlink('./codes/'.$_GET['rnd'].'.txt');
            
$r "";
                 for(
$i=0$i<strlen($username); $i++)
                {
                    
$r .= "_";
                }
                if(
$version == "wml")
                {
                    
header("Content-type: text/vnd.wap.wml; charset=utf-8");
                    
header("Cache-Control: no-cache");
                    echo(
doctype("Новая тема").$tag.$error.'
<b>Добавить тему в "'
.$back['name'].'"</b><br /> <br />
Имя: <input type="text" name="author" maxlength="10" /><br />
Тема:'
.$tagC.' <br />
<input type="text" name="topic'
.$ref.'" /><br />
'
.$tag.'Сообщение:'.$tagC.' <br />
<input type="text" name="mess'
.$ref.'" maxlength="600" /><br />');
            echo(
$tag.'Транслит: '.$tagC.'<br />
<select name="transl'
.$ref.'">
<option value="0">Нет</option>
<option value="1">Да</option>
</select><br />
<img src="./img.php?rnd='
.$ref.'" alt="" />
<br />
<a href="./?p=31&amp;v=wml&amp;f='
.$f.'&amp;rnd='.$ref.'">[Обновить код]</a><br />
Введите число на картинке сверху: <input type="text" name="code" value="" maxlength="5" size="5" /><br />'
);
echo(
'
<anchor>[Добавить]
<go href="./?p=31&amp;v=wml&amp;f='
.$f.'&amp;rnd='.$ref.'" method="post">
<postfield name="mess" value="$(mess'
.$ref.')" />
<postfield name="transl" value="$(transl'
.$ref.')" />
<postfield name="topic" value="$(topic'
.$ref.')" />
<postfield name="code" value="$(code'
.$ref.')" />
<postfield name="nt" value="1" />
</go></anchor><br />
'
.$tag.'-
<a href="./?p=14&amp;v=wml&amp;f=4">Смайлы</a><br />
<a href="./?p=2&amp;v=wml&amp;f='
.$f.'">Назад в '.$back['name'].'</a><br />
'
.$tagC.'</p></card></wml>');
                } elseif(
$version == "xhtml")
                {
                    
header("Content-type: text/html; charset=utf-8");
                    
header("Last-Modified:".gmdate("D, d M Y H:i:s")." GMT");
   
header("Cache-Control: no-cache, must-relative");
                    echo(
'<html>
<head>
<title>Новая тема</title>
</head>
<body bgcolor="'
.$style['background'].'" link="'.$style['link'].'" vlink="'.$style['link'].'" text="#000000">
<form action="./?p=31&amp;v=xhtml&amp;f='
.$f.'&amp;rnd='.$ref.'" method="post">
<table align="center" border="0" cellspacing="1" cellpadding="5" width="350">
<tr><td align="center" bgcolor="'
.$style['title'].'" colspan="2">
<font color="#FFFFFF"><b>Новая тема</b></font>
</td></tr>
<tr bgcolor="'
.$style['bottom'].'"><td colspan="2"><b>'.$tag.'Добавить тему в "'.$back['name'].'"'.$tagC.'</b></td></tr>
<tr bgcolor="#deebf1"><td colspan="2">'
.$tag.'<b>'.$error.'</b>'.$tagC.'</td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Имя:'.$tagC.'</td><td><input type="text" name="author" maxlength="10" /></td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Тема:'.$tagC.'</td><td><input type="text" name="topic"></td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Сообщение:'.$tagC.'</td><td><textarea name="mess" cols="30" rows="5"></textarea></td></tr>');
echo(
'<tr bgcolor="'.$style['text'].'"><td nowrap>'.$tag.'Транслит:'.$tagC.'</td>
<td><select name="transl">
<option value="0">Нет</option>
<option value="1">Да</option>
</select></td></tr>'
);
echo(
'
<tr bgcolor="'
.$style['text'].'"><td></td><td><img src="./img.php?rnd='.$ref.'" alt="" /><br />
<a href="./?p=31&amp;v=xhtml&amp;f='
.$f.'&amp;rnd='.$ref.'">[Обновить код]</a></td></tr>
<tr bgcolor="'
.$style['text'].'"><td>'.$tag.'Введите число на картинке сверху:'.$tagC.'</td><td><input type="text" name="code" value="" maxlength="5" size="5" /><br /></td></tr>
<tr bgcolor="'
.$style['text'].'"><td align="center" colspan="2">
<input type="hidden" name="nt" value="1">
<input type="submit" value="Добавить" /></td></tr>
<tr bgcolor="'
.$style['bottom'].'"><td colspan="2">'.$tag.'
<a href="./?p=14&amp;v=xhtml&amp;f=4">Смайлы</a><br />
<a href="./?p=2&amp;v=xhtml&amp;f='
.$back['id'].'">Назад в '.$back['name'].'</a><br />
'
.$tagC.'
</td></tr>
</table>
</form>
</body></html>'
);
                }
            } else
            {
            
unlink('./codes/'.$_GET['rnd'].'.txt');
                if(
mysql_result(
                   
mysql_query("SELECT COUNT(*)
                                FROM `themes`
                                WHERE `tname` = '"
.$topic."'
                                AND `name` = '"
.$username."'"), 0))
                {
                     
header("Location: ".$forumdir."p=2&v=".$version."&f=".$f);
                     exit();
                }
                {
                    
$SQL "INSERT INTO `themes` VALUES(0, '".$topic."', '".$username."', 'off', ".$f.", ".time().", 1, 0, '')";
                }
                
mysql_query($SQL);
                
mysql_query("INSERT INTO `posts` VALUES (0, '".$username."', '".$message."', ".crc32($message).", '".mysql_insert_id()."', '".time()."', '".$user."', '".$ip."')");
                  
header("Location: ".$forumdir."p=2&v=".$version."&f=".$f);
            }
        }
    }
}
?>
Онлайн: 1
Реклама