File "categorie.php"

Full Path: /home/analogde/www/Freebox/CHESS_ON/categorie.php
File size: 7.65 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 );
	
	$_SESSION['categorie_id'] = $_GET['id'];
	
	/*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">
<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_categorie_forum { float: left;
						width: 831px; 
						padding: 10px 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 id = "box_message">		
				<h2 class="retrait">Catégories du forum.</h2>
			</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"><a href="forum.php" title="aller à la section">Forum</a></li>
				</ul>
				
			</div>
			
			<div id = "bloc_categorie_forum">
<?php
						$sql = "SELECT cat_id, cat_name, cat_description FROM
								categories
								WHERE
								cat_id = " . mysql_real_escape_string($_GET['id']);

						$result_categorie = mysql_query($sql);
						$row = mysql_fetch_assoc($result_categorie);
						
						$sql = "SELECT * 	
								FROM
								topics
								WHERE
								topic_cat = " . mysql_real_escape_string($_GET['id']);
						$result_topic = mysql_query($sql);
						$count = mysql_num_rows($result_topic);
						//echo "Total " .$count;

						$str_utf = utf8_encode($row['cat_name']);
						//$nom_categorie = $row['cat_name'];
						$id_categorie = $_GET['id'];
	
						echo '
								<table class="tborder" style="border-bottom-width:0px" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
								<tbody>
								<tr>
								<td class="tcat" width="100%">Discussion dans la catégorie';
						echo " " .$str_utf;
						echo '  </td>
								</tr>
								</tbody>
								</table>

								<table class="tborder" id="threadslist" align="center" border="0" cellpadding="6" cellspacing="1" width="100%">
								<tbody>
								<tr>
								<td class="thead" colspan="2">&nbsp;</td>
								<td class="thead" width="100%">Sujets</td>
								<td class="thead" align="center" nowrap="nowrap" width="150">Dernier p<span style="white-space:nowrap">ost</span></td>
								<td class="thead" align="center" nowrap="nowrap">R&eacute;ponses</td>
								<td class="thead" align="center" nowrap="nowrap">Vues</td>
								</tr>';
	
								while($row = mysql_fetch_assoc($result_topic))
									{				
										$id = $row['topic_by'];
										$sql = "SELECT login FROM membres WHERE id =  '".$id."' ";
										$result = mysql_query($sql);
										$data = mysql_fetch_assoc($result);
										
										$posts_sql = "SELECT * FROM	posts
												WHERE
													post_topic =  '".$id_categorie."'
													ORDER BY post_date
													DESC
													LIMIT
													1";

										//echo $id;
										$posts_result = mysql_query($posts_sql);
										$posts_row = mysql_fetch_assoc($posts_result);
										
										$id_user = $posts_row["post_by"];
										$sql = "SELECT login FROM membres WHERE id =  '".$id_user."' ";
										$user_result = mysql_query($sql);
										$user_data = mysql_fetch_assoc($user_result);
										
										$str_utf = utf8_encode($row['topic_subject']);
										/*<a href="visualiser_post.php?id=' . $row['topic_id'] . '">' . $row['topic_subject'] . '</a>*/
										
										echo '	<tr>
												<td class="alt1">
												<img src="images/thread.gif" alt="" border="">
												</td>
								
												<td class="alt2">&nbsp;</td>
												<td class="alt1">
												<div>
												<a href="visualiser_post.php?id=' . $row['topic_id'] . '">' . $str_utf . '</a>
												</div>
												<div class="smallfont">
												<span style="font-size:smaller;">Par: ';
										echo	$data["login"];		
										echo	'</span>
												<div class="snippet">';
										echo 	$row['topic_content'];
										echo	'
												</div>
												</div>
												</td>

												<td class="alt2">
												<div class="smallfont" style="text-align:right; white-space:nowrap">';
												
										echo 	date('d-m-Y H:i:s', strtotime($posts_row['post_date']));
												
										echo	'<br>
												Par: ';
										echo	$user_data["login"];
										echo	'</div>
												</td>
								
												<td class="alt1" align="center">0</td>
												<td class="alt2" align="center">3513</td>
												</tr>';			
									}

										echo '	</tbody>
												</table>';
	
?>
	
			</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>