File "code_forum.php"

Full Path: /home/analogde/www/Massage_v1_2023/CHESS_2022/code_forum.php
File size: 3.69 KB
MIME-type: text/x-php
Charset: utf-8

<?php

	echo '
			<div id="div_menu_liste">
			
			<div id="navigation_horizontale">
				
			<ul class="menu_forum">
			<li class="forum_tag_selected"><a href="forum.php" title="aller à la section">Forum</a></li>
			<li class="categorie_tag"><a href="ajouter_categorie.php" title="aller à la section">Ajouter catégorie</a></li>
			<li class="topic_tag"><a href="ajouter_topic.php" title="aller à la section">Ajouter topic</a></li>
			</ul>
			</div>
			
			<div id="table_forum">';
	
<?php

		$sql = "SELECT	categories.cat_id, categories.cat_name,	categories.cat_description,
			    COUNT(topics.topic_id) AS topics
				FROM categories
				LEFT JOIN topics
				ON topics.topic_id = categories.cat_id
				GROUP BY categories.cat_name, categories.cat_description, categories.cat_id";

		$result = mysql_query($sql);
		
		echo '
		<table class="tborder" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
		<thead>
		<tr align="center">
		<td width="1" class="thead">&nbsp;&nbsp;&nbsp;&nbsp;</td>
	    <td class="thead" align="left" width="150">Forum</td>
	    <td class="thead" width="550">Dernier Post</td>
	    <td width="50" class="thead">Topics</td>
	    <td width="50" class="thead">Posts</td>
  	    </tr>
		</thead>'; 

		/*for($i = 0 ; $i <= 5 ; $i++)
		{*/
		
	while($row = mysql_fetch_assoc($result))
		{	
		
		$topicsql = "SELECT 
									topic_id,
									topic_subject,
									topic_date,
									topic_cat,
									topic_by
								FROM
									topics
								WHERE
									topic_cat = " . $row['cat_id'] . "
								ORDER BY
									topic_date
								DESC
								LIMIT
									1";
								
		$topicsresult = mysql_query($topicsql);
				
		
		$topicrow = mysql_fetch_assoc($topicsresult);
		//echo "+++ " .$topicrow['topic_by'];
		//echo '<a href="topic.php?id=' . $topicrow['topic_id'] . '">' . $topicrow['topic_subject'] . '</a>
		
		//$posts_sql = "SELECT user_name FROM users WHERE ";
		
		$id = $topicrow['topic_id'];
		
		$posts_sql = "SELECT 	
						posts.post_topic,
						posts.post_content,
						posts.post_date,
						posts.post_by,
						users.user_id,
						users.user_name
					FROM
						posts
					LEFT JOIN
						users
					ON
						posts.post_by = users.user_id
					WHERE
						posts.post_topic =  '".$id."' ";
						
		$posts_result = mysql_query($posts_sql);
		
		$posts_row = mysql_fetch_assoc($posts_result);
		
		
		echo '
		<tbody>
		<tr align="center">
		<td class="alt1Active" colspan="2" id="f7" align="left">
		
		<table border="0" cellpadding="0" cellspacing="0">
		<tbody><tr>
		<td><img src="Webmaster%20Forums%20-%20GIDForums_fichiers/forum_old.gif" alt="" border="0"></td>
		<td><img src="Webmaster%20Forums%20-%20GIDForums_fichiers/clear.gif" alt="" border="0" height="1" width="9"></td>
		<td>
		<div>
		<a href="http://www.gidforums.com/f-7.html"><strong>
		<a href="categorie.php?id=' . $row['cat_id'] . '">' . $row['cat_name'] . '</a>
		</strong></a>
		</div>
		</td>
		</tr>
		</tbody>
        </table>
		
		</td>
		<td class="alt2" nowrap="nowrap">
		<div class="smallfont" align="left">
		<div style="clear:both">
		<a href="page.html" title=""><strong> ';
		echo $topicrow['topic_subject'] ;
		
		echo '</strong></a>
		</div>
		<div>
        Par: ';
		
		echo $posts_row['user_name'];
		echo '
		</div>
		<div align="right">	';
		echo date('d-m-Y H:i:s', strtotime($topicrow['topic_date'])) ;
//		echo '
//		<span class="time">04:02</span> ';
		
		echo '
		<a href="http://www.gidforums.com/t-26734.html">
        <img title="Go to last post" class="inlineimg" src="images/lastpost.gif" alt="Go to last post" border="0"></a>

		</div>
		</div>
		</td>
		<td class="alt1">692</td>
		<td class="alt2">2,818</td>
		</tr>
		</tbody> ';
		}

echo '		</table>

		</div>
	
		</div> ';



?>