require( "functions.php" ); if( !isset( $id ) ) error( "Неверный вызов 'reply.php'" ); $ids = explode( ",", $id ); dbConnect(); $result = mysql_query( "SELECT rootID, name, email, topic, msg, time, ip FROM $forum_table WHERE rootID=${ids[ 1 ]}" ) or error( mysql_error() ); $row = mysql_fetch_array( $result ); unset( $result ); $result = mysql_query( "SELECT rootID, topic, name, time, ip FROM $forum_table WHERE rootID>${ids[ 0 ]} && parentID='' && ip !='' LIMIT 1" ) or error( mysql_error() ); $previousRow = mysql_fetch_row( $result ); unset( $result ); $result = mysql_query( "SELECT rootID, topic, name, time, ip FROM $forum_table WHERE rootID<${ids[ 0 ]} && parentID='' && ip != '' ORDER BY time DESC LIMIT 1" ) or error( mysql_error() ); $nextRow = mysql_fetch_row( $result ); unset( $result ); displayHeader( $forumTitle ); echo "
[Ответ] [Список тем] [Поиск] [Конференции] |
Тема: {$row[ 'topic' ]} Прислал: {$row[ 'name' ]} [" . strftime( "%c", $row[ 'time' ] ) . "] Сообщение: {$row[ 'msg' ]} "; echo $row[ 'ip' ] != "" ? "[Ответить] " : ""; displayThread( $ids[ 0 ] ); if( $previousRow != "" ) echo " Предыдущая тема: {$previousRow[ 1 ]} | От: {$previousRow[ 2 ]} [" . strftime( "%c", $previousRow[ 3 ] ) . "]"; if( $nextRow != "" ) echo " Следующая тема: {$nextRow[ 1 ]} | От: {$nextRow[ 2 ]} [" . strftime( "%c", $nextRow[ 3 ] ) . "] | ";
echo "
[Наверх]
"; displayFooter(); function displayThread( $rootID, $parentID="" ) { global $topicID, $ids, $forum_table; $query = "SELECT rootID, parentID, name, topic, time FROM $forum_table WHERE "; if( $parentID == "" ) $query .= "rootID=$rootID"; else $query .= "parentID=$rootID ORDER BY time DESC"; $result = mysql_query( $query ) or error( mysql_error() ); $time = time(); echo "