<?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');
	}*/
	
	if($_POST['categorie_titre'] && $_POST['categorie_description'] )
	{
		$heure = date("H:i");
	
		$sql = "INSERT INTO categories(cat_name, cat_description, create_by, date_creation, heure_creation)
		   VALUES('" . mysql_real_escape_string($_POST['categorie_titre']) . "',
				 '" . mysql_real_escape_string($_POST['categorie_description']) . "',
				 '" . $_SESSION['user_id'] . "',
				 NOW(),
				 '$heure'
				 )";
				 
		$result = mysql_query($sql);
		
	}	
	
	
?>

<!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">
			  
</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"><a href="forum.php" title="aller à la section">Forum</a></li>
			<li class="categorie_tag_selected"><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="form_ajout_categorie">
						
				<form method="post" enctype="multipart/form-data" id="form" action="ajouter_categorie.php" onsubmit="return valider_ajouter_categorie(this)">
			 
				<h1>Nouvelle catégorie</h1>
				
				<input type="hidden" name="valide_form" id="valide_form" value="" />
				
				<div>
					<label for="titre">Titre</label>
					<input id="categorie_titre" name="categorie_titre" type="text" value = ""  />
					<span id="statut_titre"></span>
				</div>
				
				<div>
					<label for="description">Description</label> 
					<textarea rows="4" cols="20" id="categorie_description" name="categorie_description"  style="resize: none;" ><?php echo $champ_message; ?></textarea> 
				    <span id="statut_description"></span>
				</div>

				<div>
					<input id="send" name="send" type="submit" value="Ajouter"  />
				</div>
				
<?php
				if($_SESSION['message'] == "ok")
				{	$titre = $_POST['categorie_titre'];
					echo '<div id="message_traitement" style="display:block">La catégorie ".$titre." vient d\'être crée.</div>';
					$_SESSION['message'] = "none";
				}
?>			
			</form>
							
		</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>
