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

				$_SESSION['user_id'] = 33;
				
				$sql = "INSERT INTO posts(post_content, post_date, post_topic, post_by) 
				VALUES ('$tmp' ,
				NOW(),
				" . mysql_real_escape_string($_GET['id']) . ",
				" . $_SESSION['user_id'] . ")";

				
				echo $sql;	
				$result = mysql_query($sql);
				//$id = $_GET['id'];
				//header ('Location: rafraichir_post.php?id=$id');
	}	

	
?>

<!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 -->
<!---------------------------------------------------------->	
	
	<h2 class = "retrait">Section Forum </h2>
			
			<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>
				<li class="categorie_tag"><a href="categorie.php?id=<?php echo $_SESSION['categorie_id']; ?>" title="aller à la section">Catégorie</a></li>
			</ul>
			
			</div>
			
			<div id="bloc_categorie_forum"> 
<?php			
				include('code_visualiser_post.php');
?>			
				<form action="visualiser_post.php?id=<?php echo $_GET['id']; ?> " method="post">
				<p class="tag_align"> <!-- class="tag_align" -->
					<textarea class="ckeditor" cols="50" id="editor" name="editor" rows="45">
					<?php echo $affichage ?>
					</textarea>
				</p>
				<p class="tag_align">
					<input type="submit" value="Poster">
				</p>
				</form> 
<?php 
				echo '<p align="center">Page : '; 
				for($i=1; $i<=$nombreDePages; $i++) 
				{
					if($i == $pageActuelle) 
					{
						echo ' [ '.$i.' ] '; 
					}	
					else 
					{
						echo ' <a href="visualiser_post.php?id='.$id.'&page='.$i.'">'.$i.'</a> ';
					}
				}
				echo '</p>';
?>
			</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>
