Location: PHPKode > scripts > WH Board > wh_board/topic.php
<?php require('style/layout/header.php'); ?>

    <div class="content_left"><?php $crumb = mysql_query("SELECT
                                                              topics.topic_id,
                                                              topics.topic_subject,
                                                              topics.topic_cat,
                                                              categories.cat_id,
                                                              categories.cat_name
                                                          FROM
                                                              topics
                                                          LEFT JOIN
                                                              categories
                                                          ON
                                                              topics.topic_cat = categories.cat_id
                                                          WHERE
                                                              topic_id = " . mysql_real_escape_string(intval($_GET['id']))) OR die(mysql_error()); ?>

        <?php

        if(!$crumb) {

    	echo '<ul id="breadcrumbs">
        <li><a href="index.php">' . $lang['main_page'] . '</a></li>
        <li><a href="all_categories.php" class="actual">' . $lang['topic_not_available'] . '</a></li>
        </ul>';

    	   }else{

    		if(intval(mysql_num_rows($crumb)) == 0) {

    		echo '<ul id="breadcrumbs">
            <li><a href="index.php">' . $lang['main_page'] . '</a></li>
            <li><a href="all_categories.php" class="actual">' . $lang['topic_not_available'] . '</a></li>
            </ul>';

        }else{

        ?>

        <ul id="breadcrumbs">
            <li><a href="index.php"><?php echo $lang['main_page']; ?></a></li>
            <li><a href="category.php?id=<?php while($info = mysql_fetch_assoc($crumb)) { echo intval($info['cat_id']); ?>"><?php echo htmlentities($info['cat_name'], ENT_QUOTES); ?></a></li>
            <li><a href="topic.php?id=<?php echo intval($info['topic_id']); ?>" class="actual"><?php echo htmlentities($info['topic_subject'], ENT_QUOTES); }}} ?></a></li>
        </ul>
    </div>
    <div class="content_right"><form method="post" id="search" action="search.php?search">
        <input type="text" name="search" placeholder="<?php echo $lang['enter_search_term']; ?>..." class="searchfield">
        <input type="hidden" name="submit" value="<?php echo $lang['search']; ?>" alt="<?php echo $lang['search']; ?>">
        </form>
    </div>

    <div class="clear"></div>

    <div id="headline">&nbsp;</div>

    <?php

		if((isset($_GET['id'])) && (is_numeric($_GET['id']))) {

		$id = mysql_real_escape_string($_GET['id']);
		$id = intval($_GET['id']);

			}else{

			echo '<p>' . $lang['invalid_id'] . '!</p>';
			exit();
			}

		$sql = "SELECT
					topics.topic_id,
					topics.topic_subject,
					topics.topic_cat,
					categories.cat_id,
					categories.cat_name
				FROM
					topics
				LEFT JOIN
					categories
				ON
					topics.topic_cat = categories.cat_id
				WHERE
					topic_id = " . $id;

		$result = mysql_query($sql) OR die(mysql_error());

		if(!$result) {

		echo '<p class="false">' . $lang['topic_not_available'] . '</p>' . mysql_error();

			}else{

			if(intval(mysql_num_rows($result)) == 0) {

			echo '<p class="false">' . $lang['topic_not_available'] . '</p>';

		}else{

		while($row = mysql_fetch_assoc($result)) {

    		$viewsql = "UPDATE
    						topics
    					SET
    						topic_views = topic_views + 1
    					WHERE
    						topic_id = " . $id;

    		$viewcount = mysql_query($viewsql) OR die(mysql_error());

        $count = mysql_query("SELECT post_topic FROM posts WHERE post_topic = '" . $id . "'");
        include('framework/navi_extended.php');

		include_once('functions/bbcode.php');
		include_once('functions/badwords.php');

		$posts_sql = "SELECT
						  posts.post_topic,
						  posts.post_content,
						  posts.post_date,
						  posts.post_by,
						  users.user_id,
						  users.user_name,
						  users.user_date,
						  users.user_level,
						  users.user_signature
					  FROM
						  posts
					  LEFT JOIN
						  users
					  ON
						  posts.post_by = users.user_id
					  WHERE
						  posts.post_topic = '" . $id . "'
					  LIMIT
                          $start,$entries";

		$posts_result = mysql_query($posts_sql) OR die(mysql_error());

		if(!$posts_result) {

		echo '<p class="false">' . $lang['topic_not_available'] . '</p>';

		}else{

        include_once('framework/navi_quick.php');

        echo '<div class="left"><a href="create.php?id=' . (int)$row['cat_id'] . '" class="quickbutton">' . $lang['create_new_topic'] . '</a></div>
        <div class="right">' . $link_topics . '</div>';

        echo '<div class="cleaning"></div>';

		while($posts_row = mysql_fetch_assoc($posts_result)) {

            echo '<ol id="conversationPosts" class="postList">
            <li>
            <div class="post hasControls">
            <div class="avatar"><a href="profile.php?user_id=' . (int)$posts_row['user_id'] . '"><img src="style/images/grafics/avatar_big.png" class="Avatar" border="0"></a>';

            if($posts_row['user_level'] == 0) { echo '<p class="user">User</p>'; }elseif($posts_row['user_level'] == 1) { echo '<p class="admin">Admin</p>'; }

            echo '</div>
            <div class="postContent thing">
            <div class="postHeader">
            <div class="info">
            <h3><a href="profile.php?user_id=' . (int)$posts_row['user_id'] . '">' . htmlentities($posts_row['user_name'], ENT_QUOTES) . '</a></h3>
            <span class="time">' . date('d.m.Y - H:i', strtotime($posts_row['post_date'])) . '</span>
            </div>
            <div class="controls"></div>
            </div>
            <div class="postBody">
            <p>' . bbcode(badwords(stripslashes(nl2br($posts_row['post_content'])))) . '</p>
            </div>
            </div>
            </div></li>
            </ol>';

            echo '<span class="postSignature">';

            if($posts_row['user_signature']) { echo '<span class="small_signature">' . stripslashes(strip_tags($posts_row['user_signature'])) . '</span>'; }elseif($posts_row['user_signature']== "") { echo ''; }

            echo '</span>
            <span class="postIcons"><a href="topic.php?id=' . $id . '#top"><img src="style/images/grafics/top.png" class="Top" hspace="3" border="0"></a> 
            <a href="feeds/rss.php" target="_blank"><img src="style/images/grafics/rss.png" class="Feeds" border="0"></a></span>';

            echo '<div class="cleaning"></div>';
    		}

        echo '<div id="navigation">
        <span class="pages">' . $lang['page'] . ' ' . $page . ' ' . $lang['of'] . ' ' . $allsites . '</span>';
        echo $link_string;
        echo '</div>
        <div class="clear_navi"></div>';
		}


		if(!isset($_SESSION['signed_in'])) {

		echo '<p class="green_reply">' . $lang['want_to_reply'] . '?</p><a name="reply" id="reply"></a>
        <p>' . $lang['you_have_to'] . ' <a href="signin.php">' . $lang['small_signin'] . '</a>. ' . $lang['not_yet'] . ' <a href="signup.php">' . $lang['registered'] . '</a>?</p>';

			}else{

			include_once('functions/flood.php');

			echo '<h5><img src="style/images/grafics/write.png"> ' . $lang['to_reply'] . '</h5><a name="reply" id="reply"></a>';

            echo '<form name="topic" method="post" action="reply.php?id=' . (int)$row['topic_id'] . '">
            <textarea cols="45" rows="8" name="reply" id="reply" class="textareas"></textarea><br>
            <p><small>' . $lang['spam_protection'] . '*</small><br>
            <strong>' . $lang['the_sum_of'] . ' ' . $random1 . ' + ' . $code . ' =</strong> <input size="5" name="zip" id="Spamschutz" type="text" class="protection"><input type="hidden" name="zip2" value=' . $rand_result . '></p>
            <p><input type="submit" name="submit" value="' . $lang['to_reply'] . '" alt="' . $lang['to_reply'] . '" class="buttons"></p>
            <input type="hidden" name="submitted" value="TRUE">
            </form>';
            }

        }}}

	?>

<?php require('style/layout/footer.php'); ?>
Return current item: WH Board