Просмотр файла modules/forum/index.php

Размер файла: 27.01Kb
<?php
########################################
##	           WAP-ENGINE             ##
########################################
##                                    ##
##  Автор : CHUMA (Токарев Владимир)  ##
##  e-mail : [email protected]     ##
##  WAP : http://wap-engine.ru        ##
##                                    ##
########################################
##         ВЫ НЕ ИМЕЕТЕ ПРАВО         ##
##        ИЗМЕНЯТЬ КОД СКРИПТА        ##
##  ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ!  ##
########################################
include ('../../config.php');
include ('../../templates/run.php');
include ('../../templates/func.php');
$title_page = 'Форум';
####################
$login_in = $login;
$passw_in = $passw;
$status_in = $status;

if ($portal=='off')
 {
include '../../themes/'.$themes.'.php';
  echo'<p align="center">'.$offmes.'</p>';
include ('../../templates/foot.php');

 }
if ($portal=='on')
 {
$id = filter($_GET['id']);
$str = filter($_GET['str']);
$str_r = filter($_GET['str_r']);

$razdel_data = '../../data/forum/razdel.php';
$razdel_f = file($razdel_data);
$razdel_count = count($razdel_f);
$podrazdel_data = '../../data/forum/podrazdel.php';
$podrazdel_f = file($podrazdel_data);
$podrazdel_count = count($podrazdel_f);
####################
if(empty($_GET['act']))
 {
  $m_polozhenie = 'На форуме';
  include '../../themes/'.$themes.'.php';
  
  echo'<p class="modul_name" align="center">Форум</p>';
  echo'<p align="center">Последние <a href="index.php?act=last_temy&amp;'.session_name().'='.session_id().'">темы</a> | <a href="index.php?act=last_mes&amp;'.session_name().'='.session_id().'">ответы</a></p>';
  
  if((isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in) || $dostup_forum == 1)
   {
    if($razdel_count == 4)
     {
      echo"<p class=\"err\">Нет ни одного раздела.</p>";
     }
    
    for($i = 2; $i < $razdel_count - 2; $i++)
     {
      $razdel_arr = explode('|', $razdel_f[$i]);

      echo'<p class="a"><a href="index.php?act=showrazdel&amp;str_r='.$i.'&amp;'.session_name().'='.session_id().'" class="aa">'.$razdel_arr[1].'</a><br /></p>';
     # echo'<p class="b">';
      $a = 0;
      for($ii = 2; $ii < $podrazdel_count - 2; $ii++)
       {
        $podrazdel_arr = explode('|', $podrazdel_f[$ii]);

        if($podrazdel_arr[1] == $razdel_arr[0])
         {
          $temy_count = $podrazdel_arr[4];
          if(empty($temy_count))
           { $temy_count = 0; }
          unset($mes_c);
          $mes_c = trim($podrazdel_arr[5]);
          if(empty($mes_c))
           { $mes_c = 0; }

#          echo'<a href="index.php?act=showforum&amp;id='.$podrazdel_arr[0].'&amp;str='.$ii.'&amp;str_r='.$i.'&amp;'.session_name().'='.session_id().'">'.$podrazdel_arr[2].'</a> ('.$temy_count.'|'.$mes_c.')<br />';
          $a = 1;
         }
       }
      if(empty($a))
       {
        echo"<p class=\"b\">Нет ни одного подраздела.</p>";
       }
#echo"</p>";
     }
   }
    else
   {
    echo'<p class="err">Вы не авторизованы!!! Войдите в личный кабинет.<br /></p>';
    echo'<p><br /><img src="/images/st/back.gif"align="top"alt=""/> <a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a><br /></p>';
   }
  include ('../../templates/foot.php');
 }
####################
if($_GET['act'] == 'showforum')
 {
  $podrazdel_arr = explode('|', $podrazdel_f[$str]);
  $razdel_arr = explode('|', $razdel_f[$str_r]);
  
  $title_page = $podrazdel_arr[2].' &#187; '.$razdel_arr[1].' &#187; Форум';
  
  include '../../themes/'.$themes.'.php';
  
  if((isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in) || $dostup_forum == 1)
   {
    if($str_r > 1 && $str_r < $razdel_count - 2 && $podrazdel_arr[1] == $razdel_arr[0])
     {
      echo'<p class="modul_name"align="center"><a href="index.php?'.session_name().'='.session_id().'">Форум</a> &#187; <a href="index.php?act=showrazdel&amp;str_r='.$str_r.'&amp;'.session_name().'='.session_id().'">'.$razdel_arr[1].'</a> &#187; '.$podrazdel_arr[2].'</p>';
      
      $m_polozhenie = 'На форуме в разделе "'.trim($razdel_arr[1]).' &#187; '.trim($podrazdel_arr[2]).'"';
      
      $temy_data = '../../data/forum/podrazdel/'.$id.'.php';
      $temy_f = @file($temy_data);
      @array_splice($temy_f, 0, 2);
      @array_splice($temy_f, -2, 2);
      $temy_count = count($temy_f);
      
      if(!empty($podrazdel_arr[3]) && $_SESSION['passrazd'] != trim($podrazdel_arr[3]))
       {
        if($_GET['err'] == 1)
         {
          echo'<p class="err">ОШИБКА!!! Вы не ввели пароль.<br /></p>';
         }
        if($_GET['err'] == 2)
         {
          echo'<p class="err">ОШИБКА!!! Неправильный пароль.<br /></p>';
         }
        echo'<p class="err">Внимание!!! Данный раздел под паролем.<br /></p>';
        echo'<form method="post" action="vhod.php?id='.$id.'&amp;str='.$str.'&amp;str_r='.$str_r.'&amp;'.session_name().'='.session_id().'">';
        echo'<p class="b">Пароль:<br /><input name="passrazd" maxlength="10" value="" /><br />';
        echo'<input value="Войти" name="do" type="submit" /></p></form>';
        echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="index.php?'.session_name().'='.session_id().'">В форум</a><br /></p>';
        include ('../../templates/foot.php');
        exit;
       }

      if(empty($_GET['page']))
       {
        $page_get = 1;
       }
        else
       {
        $page_get = $_GET['page'];
       }
       
      if (preg_match("#^[0-9]*$#", $page_get) && preg_match("#^[0-9]*$#", $num) && $id == $podrazdel_arr[0]) 
       {
        echo'<p class="a"><img src="/images/st/plys.gif"alt=""/> <a href="newtema.php?id='.$id.'&amp;str='.$str.'&amp;str_r='.$str_r.'&amp;'.session_name().'='.session_id().'">Новая тема</a></p>';
        
        if ($page_get < 0 || $page_get > $stranic && $stranic >=1)
         {
          echo'<p>Данной страницы несуществует!</p>';
         }
         
        if(empty($temy_f))
         {
          echo'<p class="err">Нет ни одной темы.</p>';
         }
        else
         {
          for ($i = 0; $i <= $temy_count; $i++)
           {
            if (!empty($temy_f[$i]))
             {
              $temy_arr = explode('|',$temy_f[$i]);
              $stranic_tem = ceil($temy_arr[8]/$koltemmes);
              $str_t = $i + 2;
              
              if($temy_arr[5] == '!')
               {
                echo'<p class="b">';
                echo'<img src="/images/st/01.gif"alt=""/> ';
                if($temy_arr[6] == '#')
                 {
                  echo'<img src="/images/st/02.gif"alt=""/> ';
                 }
user_data('../../data/users/'.$temy_arr[7].'.php');
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = ''.$nickname.'';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$temy_arr[7].'';
}
                echo'<a href="showtema.php?id='.$temy_arr[0].'&amp;str='.$str.'&amp;str_r='.$str_r.'&amp;'.session_name().'='.session_id().'">'.$temy_arr[4].'</a> ('.trim($temy_arr[8]).') '.$login_nick_color.' <a href="showtema.php?id='.$temy_arr[0].'&amp;str='.$str.'&amp;str_r='.$str_r.'&amp;page='.$stranic_tem.'&amp;'.session_name().'='.session_id().'">&#187;</a><br />';
                echo'</p>';
                if(isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in && ($status_in == '1' || $status_in == '2' || $status_in == '3'))
                 {
echo'<p class="dy">';
echo"[<a href=\"admin.php?act=deltem&amp;id=$id&amp;str_t=$str_t&amp;str=$str&amp;str_r=$str_r&amp;page=$page_get&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете удаление?')\">Удал</a>]";
echo"[<a href=\"admin.php?act=edittem&amp;id=$id&amp;str_t=$str_t&amp;str=$str&amp;str_r=$str_r&amp;page=$page_get&amp;".session_name()."=".session_id()."\">Ред</a>]";

echo"[<a href=\"admin.php?act=movetem&amp;id=$id&amp;str_t=$str_t&amp;str=$str&amp;str_r=$str_r&amp;page=$page_get&amp;".session_name()."=".session_id()."\">Перенести</a>]";
if($status_in == "1" || $status_in == "2")
{
echo"[<a href=\"admin.php?act=osvob&amp;id=$id&amp;str_t=$str_t&amp;str=$str&amp;str_r=$str_r&amp;page=$page_get&amp;".session_name()."=".session_id()."\">Открепить</a>]";
}
echo"</p>";
  	             }
  	           }
  	            else
  	           {
  	            $not_top_tema[] = $temy_f[$i].'|'.$str_t;
  	           }
             }
           }
          
          $temy_count = count($not_top_tema);
          $kolmes = $koltem;
          $stranic = ceil($temy_count/$kolmes);
          
          if($page_get < 0)
           {
            $page_get = 1;
           }
          if($page_get > $stranic)
           {
            $page_get = $stranic;
           }
          
          $do = $kolmes * ($page_get - 1);
          $end = $kolmes * $page_get;

          $page_nazad = $page_get - 1;
          $page_dalee = $page_get + 1;
          
          for ($i = $do; $i < $end; $i++)
           {
            if (!empty($not_top_tema[$i]))
             {
              $temy_arr = explode('|',$not_top_tema[$i]);
              $stranic_tem = ceil($temy_arr[8]/$koltemmes);
              $str_t = $i + 2;
              
              echo'<p class="b">';
              if($temy_arr[6] == '#')
               {
                echo'<img src="/images/st/02.gif"/> ';
               }
user_data('../../data/users/'.$temy_arr[7].'.php');
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = ''.$nickname.'';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$temy_arr[7].'';
}
              echo'<a href="showtema.php?id='.$temy_arr[0].'&amp;str='.$str.'&amp;str_r='.$str_r.'&amp;'.session_name().'='.session_id().'">'.$temy_arr[4].'</a> ('.trim($temy_arr[8]).') '.$login_nick_color.' <a href="showtema.php?id='.$temy_arr[0].'&amp;str='.$str.'&amp;str_r='.$str_r.'&amp;page='.$stranic_tem.'&amp;'.session_name().'='.session_id().'">&#187;</a><br />';
              echo'</p>';
              if(isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in && ($status_in == '1' || $status_in == '2' || $status_in == '3'))
               {
echo'</p><p class="dy">';
echo"[<a href=\"admin.php?act=deltem&amp;id=$id&amp;str_t=$temy_arr[9]&amp;str=$str&amp;str_r=$str_r&amp;page=$page_get&amp;".session_name()."=".session_id()."\"onclick=\"return confirm('Подтверждаете удаление?')\">Удал</a>]";
echo"[<a href=\"admin.php?act=edittem&amp;id=$id&amp;str_t=$temy_arr[9]&amp;str=$str&amp;str_r=$str_r&amp;page=$page_get&amp;".session_name()."=".session_id()."\">Ред</a>]";

echo"[<a href=\"admin.php?act=movetem&amp;id=$id&amp;str_t=$temy_arr[9]&amp;str=$str&amp;str_r=$str_r&amp;page=$page_get&amp;".session_name()."=".session_id()."\">Перенести</a>]";
if($status_in == "1" || $status_in == "2")
{
echo"[<a href=\"admin.php?act=zakrep&amp;id=$id&amp;str_t=$temy_arr[9]&amp;str=$str&amp;str_r=$str_r&amp;page=$page_get&amp;".session_name()."=".session_id()."\">Закрепить</a>]";
}
  	            echo'</p>';
  	           }
             }
           }
           
          if($stranic > 1)
           {
            echo'<p align="center" class="d">';
            echo'Страницы:';
            echo'<br />';
            if($page_get > 4)
             {
              echo"<a href=\"index.php?act=showforum&amp;id=$id&amp;str=$str&amp;str_r=$str_r&amp;page=1&amp;".session_name()."=".session_id()."\">1</a>...";
             }
 
            $start_1 = $page_get - 3;
            $end_1 = $page_get - 1;
            if($start_1 < 1)
             {
              $start_1 = 1;
             }
  
            for($i = $start_1; $i <= $end_1; $i++)
             {
              echo"<a href=\"index.php?act=showforum&amp;id=$id&amp;str=$str&amp;str_r=$str_r&amp;page=$i&amp;".session_name()."=".session_id()."\">$i</a> ";
             }

            echo$page_get;

            $start_2 = $page_get + 1;
            $end_2 = $page_get + 3;
            if($start_2 < 1)
             {
              $start_2 = 1;
             }
            if($end_2 > $stranic)
             {
              $end_2 = $stranic;
             }
  
            for($i = $start_2; $i <= $end_2; $i++)
             {
              echo" <a href=\"index.php?act=showforum&amp;id=$id&amp;str=$str&amp;str_r=$str_r&amp;page=$i&amp;".session_name()."=".session_id()."\">$i</a>";
             }

            if($stranic > $page_get && $page_get < ($stranic-3))
             {
              echo"...<a href=\"index.php?act=showforum&amp;id=$id&amp;str=$str&amp;str_r=$str_r&amp;page=$stranic&amp;".session_name()."=".session_id()."\">$stranic</a>";
             }
            echo'<br />';

            if($page_get > 1)
             {
              echo"<a href=\"index.php?act=showforum&amp;id=$id&amp;str=$str&amp;str_r=$str_r&amp;page=$page_nazad&amp;".session_name()."=".session_id()."\">Назад</a>";
             }
            echo' | ';
            if($stranic > $page_get)
             {
              echo"<a href=\"index.php?act=showforum&amp;id=$id&amp;str=$str&amp;str_r=$str_r&amp;page=$page_dalee&amp;".session_name()."=".session_id()."\">Дальше</a>";
             } 
            echo'</p>';
           }
         }
#        echo'<p><a href="newtema.php?id='.$id.'&amp;str='.$str.'&amp;str_r='.$str_r.'&amp;'.session_name().'='.session_id().'">Начать тему</a><br /></p>';
       }
      else
       {
        echo"<p class=\"err\">Попытка взлома или данный подраздел не существует!<br /></p>";
       }
     }
      elseif($str_r > 1 && $str_r < $razdel_count - 2 && $podrazdel_arr[1] != $razdel_arr[0])
     {
      echo'<p class="err">ОШИБКА!!! Данный подраздел не существует или находится в другом разделе.<br /></p>';
     }
      else
     {
      echo'<p class="err">ОШИБКА!!! Такой раздел не существует.<br /></p>';
     }
   }
    else
   {
    echo'<p class="err">Вы не авторизованы!!! Войдите в личный кабинет.<br></p>';
    echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a><br /></p>';
   }
  echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="index.php?'.session_name().'='.session_id().'">В форум</a><br /></p>';
  include ('../../templates/foot.php');
 }
####################
if($_GET['act'] == 'showrazdel')
 {
  if($str_r > 1 && $str_r < $razdel_count - 2)
   {
    $razdel_arr = explode('|', $razdel_f[$str_r]);
   }
  $title_page = $razdel_arr[1].' &#187; Форум';
  $m_polozhenie = 'На форуме в разделе '.trim($razdel_arr[1]);
  include '../../themes/'.$themes.'.php';
  
  echo'<p class="modul_name"align="center"><a href="index.php?'.session_name().'='.session_id().'">Форум</a></p>';
  
  if((isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in) || $dostup_forum == 1)
   {
    if($str_r > 1 && $str_r < $razdel_count - 2)
     {
      echo'<p class="a">'.$razdel_arr[1].'<br /></p>';
      echo'<p class="b">';
      $a = 0;
      for($ii = 2; $ii < $podrazdel_count - 2; $ii++)
       {
        $podrazdel_arr = explode('|', $podrazdel_f[$ii]);

        if($podrazdel_arr[1] == $razdel_arr[0])
         {
          $temy_f = @file("../../data/forum/podrazdel/$podrazdel_arr[0].php");
          if(!empty($temy_f))
           { $temy_count = count($temy_f) - 4; } else { $temy_count = 0; }
           
          unset($mes_c);
          for($c = 2; $c < $temy_count + 2; $c++)
           {
            $c_tem_arr = explode('|', $temy_f[$c]);
            $mes_c = $mes_c + $c_tem_arr[8];
           }
          if(empty($mes_c))
           { $mes_c = 0; }
           
          echo'<a href="index.php?act=showforum&amp;id='.$podrazdel_arr[0].'&amp;str='.$ii.'&amp;str_r='.$str_r.'&amp;'.session_name().'='.session_id().'">'.$podrazdel_arr[2].'</a> ('.$temy_count.'|'.$mes_c.')<br />';
          $a = 1;
         }
       }
      if(empty($a))
       {
        echo'Нет ни одного подраздела.';
       }
      echo'</p>';
     }
      else
     {
      echo'<p class="err">ОШИБКА!!! Такой раздел не существует.<br /></p>';
     }
   }
    else
   {
    echo'<p class="err">Вы не авторизованы!!! Войдите в личный кабинет.<br></p>';
    echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a><br /></p>';
   }
  echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="index.php?'.session_name().'='.session_id().'">В форум</a><br /></p>';
  include ('../../templates/foot.php');
 }
####################
if($_GET['act'] == 'last_temy')
 {
  $title_page = 'Последние темы &#187; Форум';
  $m_polozhenie = 'На форуме смотрит последние темы';
  include '../../themes/'.$themes.'.php';
  
  if((isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in) || $dostup_forum == 1)
   {    
      echo'<p class="modul_name"align="center"><a href="index.php?'.session_name().'='.session_id().'">Форум</a></p>';
      echo'<p class="a">Последние 20 тем</p>';
      $last_temy_data = '../../data/forum/last_temy.php';
      $last_temy_f = @file($last_temy_data);
      @array_splice($last_temy_f, 0, 2);
      @array_splice($last_temy_f, -2, 2);
      $last_temy_count = count($last_temy_f);
      $kolmes = $koltem;
      $stranic = ceil($last_temy_count/$kolmes);

      if(empty($_GET['page']))
       {
        $page_get = 1;
       }
        else
       {
        $page_get = $_GET['page'];
       }
       
      if($page_get < 0)
       {
        $page_get = 1;
       }
      if($page_get > $stranic)
       {
        $page_get = $stranic;
       }
 
      $do = $kolmes * ($page_get - 1);
      $end = $kolmes * $page_get;

      $page_nazad = $page_get - 1;
      $page_dalee = $page_get + 1;

      if (preg_match("#^[0-9]*$#", "$page_get")) 
       {
        if(empty($last_temy_f))
         {
          echo'<p class="err">Нет ни одной темы.</p>';
         }
        else
         {
          for ($i = $do; $i < $end; $i++)
           {
            if (!empty($last_temy_f[$i]))
             {
              $last_temy_arr = explode('|',"$last_temy_f[$i]");
      
              echo'<p class="b">';
user_data('../../data/users/'.$last_temy_arr[3].'.php');
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = ''.$nickname.'';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$last_temy_arr[3].'';
}
              echo'<a href="showtema.php?id='.$last_temy_arr[0].'&amp;str='.$last_temy_arr[1].'&amp;str_r='.$last_temy_arr[2].'&amp;'.session_name().'='.session_id().'">'.$last_temy_arr[6].'</a> Автор: '.$login_nick_color.' ('.$last_temy_arr[4].' '.$last_temy_arr[5].')<br />';
              echo'</p>';
             }
           }
           
          if($stranic > 1)
           {
            echo'<p align="center" class="d">';
            echo'Страницы:';
            echo'<br />';
            if($page_get > 4)
             {
              echo"<a href=\"index.php?act=last_temy&amp;page=1&amp;".session_name()."=".session_id()."\">1</a>...";
             }
 
            $start_1 = $page_get - 3;
            $end_1 = $page_get - 1;
            if($start_1 < 1)
             {
              $start_1 = 1;
             }
  
            for($i = $start_1; $i <= $end_1; $i++)
             {
              echo"<a href=\"index.php?act=last_temy&amp;page=$i&amp;".session_name()."=".session_id()."\">$i</a> ";
             }

            echo$page_get;

            $start_2 = $page_get + 1;
            $end_2 = $page_get + 3;
            if($start_2 < 1)
             {
              $start_2 = 1;
             }
            if($end_2 > $stranic)
             {
              $end_2 = $stranic;
             }
  
            for($i = $start_2; $i <= $end_2; $i++)
             {
              echo" <a href=\"index.php?act=last_temy&amp;page=$i&amp;".session_name()."=".session_id()."\">$i</a>";
             }

            if($stranic > $page_get && $page_get < ($stranic-3))
             {
              echo"...<a href=\"index.php?act=last_temy&amp;page=$stranic&amp;".session_name()."=".session_id()."\">$stranic</a>";
             }
            echo'<br />';

            if($page_get > 1)
             {
              echo"<a href=\"index.php?act=last_temy&amp;page=$page_nazad&amp;".session_name()."=".session_id()."\">Назад</a>";
             }
            echo' | ';
            if($stranic > $page_get)
             {
              echo"<a href=\"index.php?act=last_temy&amp;page=$page_dalee&amp;".session_name()."=".session_id()."\">Дальше</a>";
             } 
            echo'</p>';
           }
         }
       }
      else
       {
        echo"<p class=\"err\">Попытка взлома!<br /></p>";
       }
   }
    else
   {
    echo'<p class="err">Вы не авторизованы!!! Войдите в личный кабинет.<br></p>';
    echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a><br /></p>';
   }
  echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="index.php?'.session_name().'='.session_id().'">В форум</a><br /></p>';
  include ('../../templates/foot.php');
 }
####################
if($_GET['act'] == 'last_mes')
 {
  $title_page = 'Последние ответы &#187; Форум';
  $m_polozhenie = 'На форуме смотрит последние ответы';
  include '../../themes/'.$themes.'.php';
  
  if((isset($_SESSION['sespass']) && isset($passw_in) && $_SESSION['sespass'] == $passw_in) || $dostup_forum == 1)
   {
      echo'<p class="modul_name"align="center"><a href="index.php?'.session_name().'='.session_id().'">Форум</a></p>';
      echo'<p class="a">Последние 100 ответов</p>';
      $last_temy_data = '../../data/forum/last_mes.php';
      $last_temy_f = @file($last_temy_data);
      @array_splice($last_temy_f, 0, 2);
      @array_splice($last_temy_f, -2, 2);
      $last_temy_count = count($last_temy_f);
      $kolmes = $koltem;
      $stranic = ceil($last_temy_count/$kolmes);

      if(empty($_GET['page']))
       {
        $page_get = 1;
       }
        else
       {
        $page_get = $_GET['page'];
       }
      
      if($page_get < 0)
       {
        $page_get = 1;
       }
      if($page_get > $stranic)
       {
        $page_get = $stranic;
       }
 
      $do = $kolmes * ($page_get - 1);
      $end = $kolmes * $page_get;

      $page_nazad = $page_get - 1;
      $page_dalee = $page_get + 1;

      if (preg_match("#^[0-9]*$#", "$page_get")) 
       {         
        if(empty($last_temy_f))
         {
          echo'<p class="err">Нет последних сообщений.</p>';
         }
        else
         {
          for ($i = $do; $i < $end; $i++)
           {
            if (!empty($last_temy_f[$i]))
             {
              $last_temy_arr = explode('|',"$last_temy_f[$i]");
              $stranic_tem = ceil($last_temy_arr[7]/$koltemmes);
      
              echo'<p class="b">';
user_data('../../data/users/'.$last_temy_arr[3].'.php');
$nick_name_arr = explode('::', $nickname);
$nickname = $nick_name_arr[0];
$nickcolor = $nick_name_arr[1];
if(!empty($nickname))
{
if(!empty($nickcolor))
{
$login_nick_color = ''.$nickname.'';
}
else
{
$login_nick_color = ''.$nickname.'';
}
}
else
{
$login_nick_color = ''.$last_temy_arr[3].'';
}
              echo'<a href="showtema.php?id='.$last_temy_arr[0].'&amp;str='.$last_temy_arr[1].'&amp;str_r='.$last_temy_arr[2].'&amp;page='.$stranic_tem.'&amp;'.session_name().'='.session_id().'">'.$last_temy_arr[6].'</a> Ответил: '.$login_nick_color.' ('.$last_temy_arr[4].' '.$last_temy_arr[5].')<br />';
              echo'</p>';
             }
           }
           
          if($stranic > 1)
           {
            echo'<p align="center" class="d">';
            echo'Страницы:';
            echo'<br />';
            if($page_get > 4)
             {
              echo"<a href=\"index.php?act=last_mes&amp;page=1&amp;".session_name()."=".session_id()."\">1</a>...";
             }
 
            $start_1 = $page_get - 3;
            $end_1 = $page_get - 1;
            if($start_1 < 1)
             {
              $start_1 = 1;
             }
  
            for($i = $start_1; $i <= $end_1; $i++)
             {
              echo"<a href=\"index.php?act=last_mes&amp;page=$i&amp;".session_name()."=".session_id()."\">$i</a> ";
             }

            echo$page_get;

            $start_2 = $page_get + 1;
            $end_2 = $page_get + 3;
            if($start_2 < 1)
             {
              $start_2 = 1;
             }
            if($end_2 > $stranic)
             {
              $end_2 = $stranic;
             }
  
            for($i = $start_2; $i <= $end_2; $i++)
             {
              echo" <a href=\"index.php?act=last_mes&amp;page=$i&amp;".session_name()."=".session_id()."\">$i</a>";
             }

            if($stranic > $page_get && $page_get < ($stranic-3))
             {
              echo"...<a href=\"index.php?act=last_mes&amp;page=$stranic&amp;".session_name()."=".session_id()."\">$stranic</a>";
             }
            echo'<br />';

            if($page_get > 1)
             {
              echo"<a href=\"index.php?act=last_mes&amp;page=$page_nazad&amp;".session_name()."=".session_id()."\">Назад</a>";
             }
            echo' | ';
            if($stranic > $page_get)
             {
              echo"<a href=\"index.php?act=last_mes&amp;page=$page_dalee&amp;".session_name()."=".session_id()."\">Дальше</a>";
             } 
            echo'</p>';
           }
         }
       }
      else
       {
        echo"<p class=\"err\">Попытка взлома!<br /></p>";
       }
   }
    else
   {
    echo'<p class="err">Вы не авторизованы!!! Войдите в личный кабинет.<br></p>';
    echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="../kabinet/index.php?'.session_name().'='.session_id().'">В кабинет</a><br /></p>';
   }
  echo'<p><img src="/images/st/back.gif"align="top"alt=""/> <a href="index.php?'.session_name().'='.session_id().'">В форум</a><br /></p>';
  include ('../../templates/foot.php');
}
 }
####################

?>