require( "functions.php" );
if( !isset( $id ) ) error( "Invaild page 'reply.php' call" );
$ids = explode( ",", $id );
for ($i=0;$i${ids[ 0 ]} && parentID='' && ip !='' AND cenzored=1 LIMIT 1" ) or error( mysql_error() );
$previousRow = mysql_fetch_row( $result );
unset( $result );
$result = mysql_query( "SELECT rootID, topic, name, time, ip FROM forum WHERE rootID<${ids[ 0 ]} && parentID='' && ip != '' AND cenzored=1 ORDER BY time DESC LIMIT 1" ) or error( mysql_error() );
$nextRow = mysql_fetch_row( $result );
unset( $result );
displayHeader( $forumTitle );
echo "
Заголовок: ${row[ 3 ]}
Отправлено: ${row[ 1 ]} at " .iconv("UTF-8", "cp1251", strftime( "%c", $row[ 5 ] ) ) . "
Сообщение:
${row[ 4 ]}
[ Ответить ]
";
displayThread( $ids[ 0 ] );
if( $previousRow != "" ) echo "
<< Предыдущая тема: ${previousRow[ 1 ]}
- ${previousRow[ 2 ]}, " .iconv("UTF-8", "cp1251", strftime( "%c", $previousRow[ 3 ] ) ). " ";
if( $nextRow != "" ) echo "
>> Следующая тема: ${nextRow[ 1 ]}
- ${nextRow[ 2 ]}, " .iconv("UTF-8", "cp1251", strftime( "%c", $nextRow[ 3 ] ) ). " | ";
echo "
";
//if( $row[ 6 ] == "" ) displayFooter();
echo "
Ответить
Наверх ";
displayFooter();
function displayThread( $rootID, $parentID="" )
{
global $topicID, $ids;
$query = "SELECT rootID, parentID, name, topic, time FROM forum WHERE ";
if( $parentID == "" ) $query .= "rootID=$rootID AND cenzored=1";
else $query .= "parentID=$rootID AND cenzored=1 ORDER BY time DESC";
$result = mysql_query( $query ) or error( mysql_error() );
$time = time();
echo " \n";
while( $row = mysql_fetch_array( $result ) )
{
if( $parentID == "" ) $topicID = $row[ 'rootID' ];
if( $row[ 'rootID' ] == $ids[ 1 ] ) echo " - ${row[ 'topic' ]}";
else echo "
- ${row[ 'topic' ]}";
echo " - ${row[ 'name' ]}, " .iconv("UTF-8", "cp1251", strftime( "%c", $row[ 'time' ]) ) . "
\n";
displayThread( $row['rootID'], $row['parentID'] );
}
echo " \n";
}
?>
|