File "forum.php"

Full Path: /home/analogde/www/Bookmarks/CHESS_ON/forum.php
File size: 7.7 KB
MIME-type: text/x-php
Charset: utf-8

<?php
	session_start();
	include('database.php');
	DB_connexion(); 
	
	ini_set( 'display_errors', '0');
	error_reporting( 0 );
	
	/*if(!isset($_SESSION['logged']) )
	{		header ('Location: interdiction.php');
	}
	
	if($_SESSION['logged']== "no")
	{
		header ('Location: interdiction.php');
	}*/
	
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Description" content="Site perso,cours,ouvrages" />
<meta name="Keywords" content="WEBSITE perso " />
<meta name="Distribution" content="Global" />
<meta name="Robots" content="" />
<meta http-equiv="Content-Language" content="fr" />
<meta name="rating" content="general" />
<meta name="author" content="Patrice DELPY" />
<meta name="copyright" content="Copyright 2013" />
<meta name="generator" content="Patoche" />
<title>Patoche WEBSITE - 2013 - Template du site - en cours de développemment ...</title>

<!---------------------------------------------------------->	
<?php
		include('include_css_template_commun.php');
		include('include_css.php');
		include('css_tools_skill.php');
		include('include_javascript.php');

?> 

<style type="text/css">
#bloc_table_forum { float: left;
					width: 831px; 
					padding: 50px 50px 25px 50px;
					}	
</style>

<script type="text/javascript">
function call_update()
{
	 ajax_routine(); 
	 setTimeout("call_update()", 1000); //appelle la fonction 1 fois par  seconde
}
</script>

<!---------------------------------------------------------->	
</head>

<body>
<!---------------------------------------------------------->	
	<div class="main"> <!-- main -->
<!---------------------------------------------------------->	

          <div class="header">
                <div class="balise_titre">Patoche</div>
                <div class="balise_citation">
                &quot;Etre conscient que l'on est ignorant est un grand pas vers le savoir&quot;
                </div>
          </div> 
 
          <div class="banniere"></div>  

<!---------------------------------------------------------->
<?php
/*	include("include_barre_login.php");
	echo '<div id="box_icon">';
	include("debug_connexion_membre.php");
	echo '</div>';
	include("include_menu.php");*/
	
	echo '<div id="box_infos">';
			include("include_menu.php");
			
			echo '<div id="box_icon2">';
			include("connexion_membre.php");
			echo	'</div>';
			
			echo '<div id="box_icon3">';
			include("include_barre_login.php");
			echo	'</div>';

	echo	'</div>';
	$_SESSION['page_active'] = basename (__FILE__ );
?>
		

<!---------------------------------------------------------->	
            <div class="contenu"> <!-- contenu -->
<!---------------------------------------------------------->	
	
			<div class="barre_vide"></div>
			
			<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>
				-->
				<ul id="menu_horiz">
				<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="bloc_table_forum">
	
<?php


		/* encodage 
		mysql_select_db($database, $connection);
		mysql_query("SET NAMES 'utf8'");
		
		ou bien mysql_set_charset
		*/
		
		$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);
		
		$str_utf = utf8_encode($row['cat_name']);
		
		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>
		
		*/
		echo '
		<a href="categorie.php?id=' . $row['cat_id'] . '">' . $str_utf . '</a> ';
				
		echo '
		</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://nada.html">
        <img title="Allez au dernier post" class="inlineimg" src="images/lastpost.gif" alt="Dernier post" border="0"></a>

		</div>
		</div>
		</td>
		<td class="alt1">0</td>
		<td class="alt2">0</td>
		</tr>
		</tbody> ';
		}
		?>

<!----------------------------------------------------------------->

		</table>
		
		</div>
		
<!--	</div>	-->

	<br/>
	<br/>
	<br/>
	<br/>
	<br/>
           

<!---------------------------------------------------------->	
<?php			
    include('include_pied_page.php');
	include('include_publicite.php');
?>
<!---------------------------------------------------------->	
			</div>  <!-- contenu -->
<!---------------------------------------------------------->	
	</div>   <!-- main -->
<!---------------------------------------------------------->	

	<script type="text/javascript">
		call_update()
	</script>

</body>
</html>