1) { setcookie("dragrace_ru_user",$user); $dragrace_ru_user = $user; }; require( "functions.php" ); dbConnect(); $result = mysql_query( "SELECT rootID FROM $forum_table WHERE parentID=''" ) or error( mysql_error() ); $totalThread = mysql_num_rows( $result ); unset( $result ); $result = mysql_query( "SELECT rootID FROM $forum_table" ) or error( mysql_error() ); $totalMsg = mysql_num_rows( $result ); unset( $result ); if( !isset( $page ) ) $page = 1; if( $totalThread <= $maxThread ) $totalPages = 1; elseif( $totalThread % $maxThread == 0 ) $totalPages = $totalThread / $maxThread; else $totalPages = ceil( $totalThread / $maxThread ); if( $page > $totalPages ) $page = 1; if( $totalThread == 0 ) $threadStart = 0; else $threadStart = $maxThread * $page - $maxThread + 1; if( $page == $totalPages ) $threadEnd = $totalThread; else $threadEnd = $maxThread * $page; $initialMsg = $maxThread * $page - $maxThread; displayHeader( $forumTitle ); echo "
Всего $totalMsg сообщений в $totalThread дискуссиях,
на этой странице $threadStart - $threadEnd дискуссии
[Новая тема] [Поиск] [Конференции]
"; echo "

Страница:  "; for( $i = 1; $i <= $totalPages; $i++ ) { if( $page == $i ) echo "$i  "; else echo "$i  "; } echo "



"; displayThread(); echo "

Страница:  "; for( $i = 1; $i <= $totalPages; $i++ ) { if( $page == $i ) echo "$i  "; else echo "$i  "; } echo "


Новая тема

Тема:
Имя:
E-mail:
Сообщение:
(использование тэгов)
  Посылать ответы по почте
 

[Наверх]

"; displayFooter(); /* Recursion procedure displays threads */ function displayThread( $rootID="", $parentID="" ) { global $initialMsg, $maxThread, $topicID, $forum_table; $query = "SELECT rootID, parentID, name, topic, time, ip FROM $forum_table WHERE "; if( $parentID == "" ) $query .= "parentID='' ORDER BY time DESC LIMIT $initialMsg, $maxThread"; else $query .= "parentID=$rootID ORDER BY time DESC"; $result = mysql_query( $query ) or error( mysql_error() ); $time = time(); echo " \n"; } ?>