<?php
session_start();
include('../connexion.php');
if (!isset($_SESSION['celest']))
{
	header ('Location: index.php');
}
$active='parametre';
if (isset($_GET['W9mvyDvFWE5']))
{
	$chaiz=($_GET['W9mvyDvFWE5']);
	$id=($_GET['QYtgoGbhhd']);	
	$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
	$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
	$data=$reponse->fetch();
	require_once('active.php');
	if($data[0]==NULL)
	{
		header('Location: index.php');
	}
?>
	<?php include('tete.php'); ?>
    <link rel="stylesheet" type="text/css" href="style/style_admin.css" />
</head>
<body>
    <div id="wrapper">
    	<?php include('menu_admin.php'); ?>
        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-2 col-md-1"></div>
                <div class="col-lg-8 col-md-10 col-sm-11 col-xs-12" id="administration">
                    <div id="titro_admin">Modification
					<?php
					$sql2= 'SELECT * FROM privilege WHERE lib_privilege="'.$chaiz.'"';
					$reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
					$data2=$reponse2->fetch();
                    echo $data2['afficher_privilege'];
					?>
                    </div>
                    <?php
                    switch($chaiz)
					{
						case 'grande_categorie':
						case 'type_forum':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(($_POST['nom']));
								$present=(($_POST['present']));
								$name_img=$_FILES['tof']['name'];
								$type_img=$_FILES['tof']['type'];
								$size_img=$_FILES['tof']['size'];
								$temp_img=$_FILES['tof']['tmp_name'];
								$error_img=$_FILES['tof']['error'];
								
								$extension=strrchr($name_img,'.');
								$date_mise=date('Y-m-d H:i:s');

								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								else
								{
									if ($error_img==0)
									{
										if ($extension=='.jpg' or $extension=='.png' or $extension=='.jpeg' or $extension=='.gif' or $extension=='.bmp' or $extension=='.JPG' or $extension=='.PNG' or $extension=='.JPEG' or $extension=='.GIF' or $extension=='.BMP')
										{
											$lien_img=$date_img.'777ng_koben'.$extension;
											move_uploaded_file($temp_img, "../upload/".$lien_img);
										}
										else
										{
											echo '<div class="alert alert-danger">Format Incorrect </div>';
											?> 
											<script type="text/javascript">
                                            window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",3000);
                                            </script>
                                            <?php
											break;
										}
									}
									else
									{
										$lien_img=$data['img_'.$chaiz.''];
									}
									$url=strtolower(str_replace($suppression, $ajouter, $nom));
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", descrip_'.$chaiz.'="'.$present.'", img_'.$chaiz.'="'.$lien_img.'", url_'.$chaiz.'="'.$url.'" WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									/*$req='INSERT INTO modificateur VALUES (NULL, "'.$nom.'", "'.$nombre.'", "'.$fichier.'", "'.$video.'", "'.$url.'", 0)';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());*/
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h4>Titre</h4>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
                        	<h4>Description</h4>
							<textarea class="form-control" id="present" name="present"><?php echo stripslashes($data['descrip_'.$chaiz.'']) ?></textarea>
                            <script>
								CKEDITOR.replace('present');
							</script>
                            <h4>Image</h4>
                            <?php
                            if($data['img_'.$chaiz.'']!='')
							{
								$limg='<img src="../upload/'.$data['img_'.$chaiz.''].'" id="float_img">';
							}
							else
							{
								$limg='<img src="../img/noimage.png" id="float_img">';
							}
							echo $limg
							?>
                            <input type="file" class="form-control" name="tof">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'type':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql2 = 'SELECT COUNT(*) as nbr FROM selection';
						$reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
						$data2 =$reponse2->fetch();
						$nbr_selection=$data2[0];
						
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$nombre=(addslashes($_POST['nombre']));
								$fichier=(addslashes($_POST['fichier']));
								$video=(addslashes($_POST['video']));
								$fa=(addslashes($_POST['fa']));
								$date_mise=date('Y-m-d H:i:s');
								
								$nbr_checkbox=0;
								for ($n=1; $n<=$nbr_selection; $n++)
								{
									if (isset($_POST['selection'.$n.'']))
									{
										$checkbox=($_POST['selection'.$n.'']);
										if (!empty($checkbox))
										{
											$nbr_checkbox++;
										}
									}
								}
								
								
								if ($nbr_checkbox==0)
								{
									echo '<div class="alert alert-danger">Veuillez choisir au moins une option</div>';
								}
								elseif ($nombre=='')
								{
									//echo '<div class="alert alert-danger">Veuillez renseigner le nombre d\'image</div>';
									$nombre=1;
								}
								elseif ($fichier=='')
								{
									//echo '<div class="alert alert-danger">Veuillez renseigner le nombre de fichier</div>';
									$fichier=1;
								}
								elseif ($video=='')
								{
									//echo '<div class="alert alert-danger">Veuillez renseigner le nombre de vidéo</div>';
									$video=1;
								}
								else
								{
									$url=strtolower(str_replace($suppression, $ajouter, $nom));
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", nnombre_'.$chaiz.'="'.$nombre.'", nfichier_'.$chaiz.'="'.$fichier.'" , nvideo_'.$chaiz.'="'.$video.'", url_'.$chaiz.'="'.$url.'", fa_'.$chaiz.'="'.$fa.'" WHERE id_'.$chaiz.'='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='DELETE FROM selection_type WHERE id_type='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$nbr_checkbox=0;
									for ($n=1; $n<=$nbr_selection; $n++)
									{
										if (isset($_POST['selection'.$n.'']))
										{
											$checkbox=($_POST['selection'.$n.'']);
											$obliger=($_POST['obliger'.$n.'']);
											if (!empty($checkbox))
											{
												$nbr_checkbox++;
												$req='INSERT INTO selection_type VALUES ("'.$checkbox.'", "'.$id.'", "'.$date_mise.'", "'.$date_mise.'", "'.$obliger.'")';
												$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
											}
										}
									}
									$req='INSERT INTO modificateur (`id_modificateur`, `id_type`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> ajout effectué avec succès avec '.$nbr_checkbox.' champs</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
							<h5>Nombre d'image</h5>
							<input type="text" class="form-control" name="nombre" value="<?php echo stripslashes($data['nnombre_'.$chaiz.'']) ?>">
							<h5>Nombre de fichier</h5>
							<input type="text" class="form-control" name="fichier" value="<?php echo stripslashes($data['nfichier_'.$chaiz.'']) ?>">
							<h5>Nombre de vidéo</h5>
							<input type="text" class="form-control" name="video" value="<?php echo stripslashes($data['nvideo_'.$chaiz.'']) ?>">
							<h5>Icone font awesone</h5>
							<input type="text" class="form-control" name="fa" value="<?php echo stripslashes($data['fa_'.$chaiz.'']) ?>">
                            <h5>Champs utilisés</h5>
                            <div id="checkbox">
								<?php
                                $i=0;
                                $sql= 'SELECT * FROM selection ORDER BY id_selection ASC';
                                $reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
                                while ($data=$reponse->fetch())
                                {
									$y=0;
									$sql3= 'SELECT * FROM selection_type, type WHERE type.id_type=selection_type.id_type AND type.id_type="'.$id.'"';
									$reponse3=$bdd->query($sql3) or die('Erreur SQL !<br />'.$sql3.'<br />'.mysql_error());
									while($data3=$reponse3->fetch())
									{
										//echo $data3['id_selection']. ' '.$data['id_selection'].' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ';
										if($data3['id_selection']==$data['id_selection'])
										{
											$y++;
											$checked=' checked';
											$obligation=$data3['obligation_type'];
											break;
										}
										else
										{
											$y++;
											$checked='';
											$obligation='';
										}
									}
                                    $i++;
									if($y==0)
									{
										$checked='';
										$obligation='';
									}
                                    ?>
                                    <script type="text/javascript">
									function Change<?php echo $i; ?>() {
									if ((document.getElementById('oui<?php echo $i; ?>').checked)) {
										document.getElementById('rai<?php echo $i; ?>').style.display="block";
									}
									else {
									document.getElementById('rai<?php echo $i; ?>').style.display="none";
									}
									}
									</script>
                                    <div id="box-price">
                                        <input <?= $checked ?> type="checkbox" name="selection<?php echo $i; ?>" class="checkbox-inline" value="<?php echo $data['id_selection'] ?>" onClick="Change<?php echo $i; ?>()" id="oui<?php echo $i; ?>">
                                        <?php echo $data['lib_selection'] ?>
                                        <span id="rai<?php echo $i; ?>" <?php if($checked==''){ ?> style="display:none"<?php } ?>>
                                            <!-- <input type="text" class="form-control" name="obliger<?php echo $i; ?>" placeholder="Obliger 0/1" id="price" value="<?php echo $obligation ?>" onKeypress="if(event.keyCode < 45 || event.keyCode > 57) event.returnValue = false;if(event.which < 45 || event.which > 57) return false;"> -->
                                            <select name="obliger<?php echo $i; ?>" class="form-control" id="type_slider">
                                            	<option value="1">1 - Champ obligatoire</option>
                                            	<option value="0">0 - Champ facultatif</option>
				                            </select>
                                            <?php
                                            /*if($data[0] == 6)
                                            {
                                            	?>
                                            	<select name="type_slider<?php echo $i; ?>" class="form-control" id="type_slider">
	                                            	<option value="">---------------------</option>
													<?php
													$sql2= 'SELECT * FROM type_slider ORDER BY lib_type_slider ASC';
					                                $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
					                                while ($data2 =$reponse2->fetch())
					                                {
					                                    if(isset($_POST['valider']) and $_POST['type_slider']==$data2[0])
					                                    {
					                                        echo $cocher=' selected="selected"';
					                                    }
					                                    else
					                                    {
					                                        echo $cocher='';
					                                    }
					                                    echo '<option'.$cocher.' value="'.$data2[0].'">'.$data2['lib_type_slider'].' '.$data2['width_type_slider'].'x'.$data2['height_type_slider'].'</option>';
					                                }
					                                ?>
					                            </select>
                                            	<?php
                                            }*/
                                            ?>
                                        </span>
                                    </div>
                                    <?php
                                }
                                ?>
                            </div>
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'user':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql2 = 'SELECT COUNT(*) as nbr FROM privilege';
						$reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
						$data2 =$reponse2->fetch();
						$nbr_selection=$data2[0];
						$sql2 = 'SELECT COUNT(*) as nbr FROM type';
						$reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
						$data2 =$reponse2->fetch();
						$nbr_selection2=$data2[0];
						
						$sql= 'SELECT * FROM '.$chaiz.', type_user WHERE type_user.id_type_user=user.id_type_user AND id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						
						if($data['id_type_user']==1 and $developpeur!=1)
						{
							?>
							<script type="text/javascript">document.location.href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz;?>"</script>
							<?php
						}
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								/*$langue=(addslashes($_POST['langue']));*/
								$type=(addslashes($_POST['type']));
								$login=(addslashes($_POST['login']));
								$mail=(addslashes($_POST['mail']));
								$bloquer=(addslashes($_POST['bloquer']));
								$mdp1=(addslashes($_POST['mdp1']));
								$date_mise=date('Y-m-d H:i:s');
								
								$nbr_checkbox=0;
								for ($n=1; $n<=$nbr_selection; $n++)
								{
									if (isset($_POST['selection'.$n.'']))
									{
										$checkbox=($_POST['selection'.$n.'']);
										if (!empty($checkbox))
										{
											$nbr_checkbox++;
										}
									}
								}
								$nbr_type=0;
								for ($n=1; $n<=$nbr_selection2; $n++)
								{
									if (isset($_POST['type'.$n.'']))
									{
										$checkbox=($_POST['type'.$n.'']);
										if (!empty($checkbox))
										{
											$nbr_type++;
										}
									}
								}
								
								
								/*if ($nbr_checkbox==0)
								{
									echo '<div class="alert alert-danger">Veuillez choisir au moins un privilège</div>';
								}*/
								if (empty($login))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le login</div>';
								}
								elseif (empty($type))
								{
									echo '<div class="alert alert-danger">Veuillez choisir le type d\'utilisateur</div>';
								}
								/*elseif (empty($role))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le role</div>';
								}*/
								elseif (empty($bloquer))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le blocage (1 ou 0)</div>';
								}
								/*elseif (empty($langue))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner la langue (oui ou non)</div>';
								}*/
								elseif (empty($mdp1))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le mote de passe</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$login.'", mail_'.$chaiz.'="'.$mail.'", mdp_'.$chaiz.'="'.$mdp1.'", bloquer_'.$chaiz.'="'.$bloquer.'", id_type_user='.$type.' WHERE id_'.$chaiz.'='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='DELETE FROM user_privilege WHERE id_user='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='DELETE FROM user_type WHERE id_user='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$nbr_checkbox=0;
									for ($n=1; $n<=$nbr_selection; $n++)
									{
										if (isset($_POST['selection'.$n]))
										{
											$checkbox=($_POST['selection'.$n]);
											if (!empty($checkbox))
											{
												$nbr_checkbox++;
												$req='INSERT INTO user_privilege VALUES ('.$id.', "'.$checkbox.'", "'.$date_mise.'", "'.$date_mise.'")';
												$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
											}
										}
									}
									
									$nbr_checkbox=0;
									for ($n=1; $n<=$nbr_selection2; $n++)
									{
										if (isset($_POST['type'.$n.'']))
										{
											$checkbox=($_POST['type'.$n.'']);
											if (!empty($checkbox))
											{
												$nbr_checkbox++;
												$req='INSERT INTO user_type VALUES ("'.$id.'", "'.$checkbox.'", "'.$date_mise.'", "'.$date_mise.'")';
												$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
											}
										}
									}
									/*if($data10['role_user']=='superadmin')
									{
										if($langue=='non')
										{
											unset($_SESSION['langue']);
										}
										else
										{
											$_SESSION['langue'] = 1;
										}
									}*/
									$req='INSERT INTO modificateur (`id_modificateur`, `id_user`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success">Ajout effectué avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
                        	<h5>Login</h5>
							<input autofocus type="text" class="form-control" name="login" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
                            <h5>Email</h5>
							<input type="text" class="form-control" name="mail" value="<?php echo stripslashes($data['mail_'.$chaiz.'']) ?>">
                        	<h5>Type d'utilisateur</h5>
                            <select name="type" class="form-control">
							<?php
                            if($developpeur==1)
							{
								$sql2= 'SELECT * FROM type_user ORDER BY lib_type_user ASC';
							}
							else
							{
								$sql2= 'SELECT * FROM type_user WHERE id_type_user<>1 ORDER BY lib_type_user ASC';
							}
                            $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                            while ($data2 =$reponse2->fetch()) 
                            {
                                if ($data2[0]==$data['id_type_user'])
                                {
                                    $cocher='selected';
                                }
                                else
                                {
                                    $cocher='';
                                }
                                echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2[1].'</option>';
                            }
                            ?>
                            </select>
                        	<h5>Bloquer <span id="span">(1/0)</span></h5>
                            <select name="bloquer" class="form-control">
                            	<option<?php if($data['bloquer_user']==1){ echo ' selected';} ?>>1</option>
                            	<option<?php if($data['bloquer_user']==0){ echo ' selected';} ?>>0</option>
                            </select>
                        	<!--<h5>Langue <span id="span">(Oui/Non)</span></h5>
							<input type="text" class="form-control" name="langue" value="<?php //echo stripslashes($data['langue_'.$chaiz.'']) ?>">-->
                        	<h5>Mot de passe</h5>
							<input type="text" class="form-control" name="mdp1" value="<?php echo stripslashes($data['mdp_'.$chaiz.'']) ?>">
                            <h5>Privilèges</h5>
                            <div id="checkbox">
								<?php
                                $i=0;
                                if($developpeur==1)
								{
                                	$sql= 'SELECT * FROM privilege ORDER BY id_privilege ASC';
								}
								else
								{
                                	$sql= 'SELECT * FROM privilege WHERE visible_privilege=1 ORDER BY id_privilege ASC';
								}
                                $reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
                                while ($data=$reponse->fetch())
                                {
									$m=0;
									$sql3= 'SELECT * FROM user_privilege, privilege WHERE privilege.id_privilege=user_privilege.id_privilege AND id_user="'.$id.'"';
									$reponse3=$bdd->query($sql3) or die('Erreur SQL !<br />'.$sql3.'<br />'.mysql_error());
									while($data3=$reponse3->fetch())
									{
										$m++;
										if($data3['id_privilege']==$data['id_privilege'])
										{
											$checked=' checked';
											break;
										}
										else
										{
											$checked='';
										}
									}
                                    $i++;
									if($m==0)
									{
										$checked='';
									}
                                    ?>
                                    <input <?php echo $checked ?> type="checkbox" name="selection<?php echo $i; ?>" class="checkbox-inline" value="<?php echo $data['id_privilege'] ?>">
                                    <?php
                                    echo $data['afficher_privilege'];
                                }
                                ?>
                            </div>

                            <h5>Rubriques</h5>
                            <div id="checkbox">
								<?php
                                $i=0;
                                $sql= 'SELECT * FROM type ORDER BY id_type ASC';
                                $reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
                                while ($data=$reponse->fetch())
                                {
									$m=0;
									$sql3= 'SELECT * FROM user_type, type WHERE type.id_type=user_type.id_type AND id_user="'.$id.'"';
									$reponse3=$bdd->query($sql3) or die('Erreur SQL !<br />'.$sql3.'<br />'.mysql_error());
									while($data3=$reponse3->fetch())
									{
										$m++;
										if($data3['id_type']==$data['id_type'])
										{
											$checked=' checked';
											break;
										}
										else
										{
											$checked='';
										}
									}
                                    $i++;
									if($m==0)
									{
										$checked='';
									}
                                    ?>
                                    <input <?php echo $checked ?> type="checkbox" name="type<?php echo $i; ?>" class="checkbox-inline" value="<?php echo $data['id_type'] ?>">
                                    <?php
                                    echo $data['lib_type'];
                                }
                                ?>
                            </div>
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'typeinfo':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'='.$id;
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$type=(addslashes($_POST['type']));
								$present=(addslashes($_POST['present']));
								$fa=(addslashes($_POST['fa']));

								$name_img=$_FILES['tof']['name'];
								$type_img=$_FILES['tof']['type'];
								$size_img=$_FILES['tof']['size'];
								$temp_img=$_FILES['tof']['tmp_name'];
								$error_img=$_FILES['tof']['error'];
								
								$extension=strrchr($name_img,'.');
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								elseif (empty($type))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								else
								{
									if ($error_img==0)
									{
										if ($extension=='.jpg' or $extension=='.png' or $extension=='.jpeg' or $extension=='.gif' or $extension=='.bmp' or $extension=='.JPG' or $extension=='.PNG' or $extension=='.JPEG' or $extension=='.GIF' or $extension=='.BMP')
										{
											$lien_img=$date_img.'777ng_koben'.$extension;
											move_uploaded_file($temp_img, "../upload/".$lien_img);
										}
										else
										{
											echo '<div class="alert alert-danger">Format Incorrect </div>';
											?> 
											<script type="text/javascript">
                                            window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",3000);
                                            </script>
                                            <?php
											break;
										}
									}
									else
									{
										$lien_img=$data['img_'.$chaiz.''];
									}
									$url=strtolower(str_replace($suppression, $ajouter, $nom));
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", url_'.$chaiz.'="'.$url.'", img_typeinfo="'.$lien_img.'", descrip_typeinfo="'.$present.'", fa_typeinfo="'.$fa.'", id_type='.$type.' WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_'.$chaiz.'`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
							<h5>Icone font awesone</h5>
							<input type="text" class="form-control" name="fa" value="<?php echo stripslashes($data['fa_'.$chaiz.'']) ?>">
                            <h5>Type table</h5>
                            <select name="type" class="form-control">
							<?php
                            $sql2 = "SELECT * FROM type ORDER BY lib_type ASC";
                            $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                            while ($data2 =$reponse2->fetch()) 
                            {
                                if ($data2[0]==$data['id_type'])
                                {
                                    $cocher='selected';
                                }
                                else
                                {
                                    $cocher='';
                                }
                                echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2['lib_type'].'</option>';
                            }
                            ?>
							</select>
                            <h5>Description</h5>
							<textarea class="form-control" id="present" name="present"><?php echo stripslashes($data['descrip_'.$chaiz.'']) ?></textarea>
                            <script>
								CKEDITOR.replace('present');
							</script>
                            <h5>Image</h5>
                            <?php
                            if($data['img_'.$chaiz.'']!='')
							{
								$limg='<img src="../upload/'.$data['img_'.$chaiz.''].'" id="float_img">';
							}
							else
							{
								$limg='<img src="img/noimage.png" id="float_img">';
							}
							echo $limg
							?>
                            <input type="file" class="form-control" name="tof">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'categorie':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'='.$id;
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$type=(addslashes($_POST['type']));
								$typeinfo=(addslashes($_POST['typeinfo']));
								$present=(addslashes($_POST['present']));

								$name_img=$_FILES['tof']['name'];
								$type_img=$_FILES['tof']['type'];
								$size_img=$_FILES['tof']['size'];
								$temp_img=$_FILES['tof']['tmp_name'];
								$error_img=$_FILES['tof']['error'];
								
								$extension=strrchr($name_img,'.');
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								elseif (empty($type))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner type table</div>';
								}
								elseif (empty($typeinfo))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le type d\'information</div>';
								}
								else
								{
									if ($error_img==0)
									{
										if ($extension=='.jpg' or $extension=='.png' or $extension=='.jpeg' or $extension=='.gif' or $extension=='.bmp' or $extension=='.JPG' or $extension=='.PNG' or $extension=='.JPEG' or $extension=='.GIF' or $extension=='.BMP')
										{
											$lien_img=$date_img.'777ng_koben'.$extension;
											move_uploaded_file($temp_img, "../upload/".$lien_img);
										}
										else
										{
											echo '<div class="alert alert-danger">Format Incorrect </div>';
											?> 
											<script type="text/javascript">
                                            window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",3000);
                                            </script>
                                            <?php
											break;
										}
									}
									else
									{
										$lien_img=$data['img_'.$chaiz.''];
									}
									$url=strtolower(str_replace($suppression, $ajouter, $nom));
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", url_'.$chaiz.'="'.$url.'", id_type="'.$type.'", img_'.$chaiz.'="'.$lien_img.'", descrip_'.$chaiz.'="'.$present.'", id_typeinfo='.$typeinfo.' WHERE id_'.$chaiz.'='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_'.$chaiz.'`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
                            <h5>Type d'information</h5>
                            <select name="typeinfo" class="form-control">
							<?php
                            $sql2 = "SELECT * FROM typeinfo ORDER BY lib_typeinfo ASC";
                            $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                            while ($data2 =$reponse2->fetch()) 
                            {
                                if ($data2[0]==$data['id_typeinfo'])
                                {
                                    $cocher='selected';
                                }
                                else
                                {
                                    $cocher='';
                                }
                                echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2['lib_typeinfo'].'</option>';
                            }
                            ?>
							</select>
                            <h5>Type table</h5>
                            <select name="type" class="form-control">
							<?php
                            $sql2 = "SELECT * FROM type ORDER BY lib_type ASC";
                            $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                            while ($data2 =$reponse2->fetch()) 
                            {
                                if ($data2[0]==$data['id_type'])
                                {
                                    $cocher='selected';
                                }
                                else
                                {
                                    $cocher='';
                                }
                                echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2['lib_type'].'</option>';
                            }
                            ?>
							</select>
                            <h5>Description</h5>
							<textarea class="form-control" id="present" name="present"><?php echo stripslashes($data['descrip_'.$chaiz.'']) ?></textarea>
                            <script>
								CKEDITOR.replace('present');
							</script>
                            <h5>Image</h5>
                            <?php
                            if($data['img_'.$chaiz.'']!='')
							{
								$limg='<img src="../upload/'.$data['img_'.$chaiz.''].'" id="float_img">';
							}
							else
							{
								$limg='<img src="img/noimage.png" id="float_img">';
							}
							echo $limg
							?>
                            <input type="file" class="form-control" name="tof">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'selection':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$champ=(addslashes($_POST['champ']));
								$select=(addslashes($_POST['select']));
								$afficher=(addslashes($_POST['afficher']));
								$privilege=addslashes(($_POST['privilege']));
								if($privilege=='')
								{
									$privilege='NULL';
								}
								echo $privilege;
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								elseif (empty($afficher))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le nom à afficher dans l\'administration</div>';
								}
								if (empty($champ))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le type</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", afficher_'.$chaiz.'="'.$afficher.'", select_'.$chaiz.'="'.$select.'", id_champ="'.$champ.'", id_privilege='.$privilege.' WHERE id_'.$chaiz.'='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_selection`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
							<h5>Affichage dans l'administration</h5>
							<input type="text" class="form-control" name="afficher" value="<?php echo stripslashes($data['afficher_'.$chaiz.'']) ?>">
							<h5>Type de select (<span id="span">table / classique</span>)</h5>
							<input type="text" class="form-control" name="select" value="<?php echo stripslashes($data['select_'.$chaiz.'']) ?>">
                            <h5>Type champ</h5>
                            <select name="champ" class="form-control">
							<?php
                            $sql2 = "SELECT * FROM champ ORDER BY lib_champ ASC";
                            $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                            while ($data2 =$reponse2->fetch()) 
                            {
                                if ($data2[0]==$data['id_champ'])
                                {
                                    $cocher='selected';
                                }
                                else
                                {
                                    $cocher='';
                                }
                                echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2[1].'</option>';
                            }
                            ?>
                          </select>
                          <h5>Table</h5>
                            <select name="privilege" class="form-control">
                           	<option value="">-----------------------------------------</option>
							<?php
                            $sql2 = "SELECT * FROM privilege ORDER BY lib_privilege ASC";
                            $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                            while ($data2 =$reponse2->fetch()) 
                            {
                                if ($data2[0]==$data['id_privilege'])
                                {
                                    $cocher='selected';
                                }
                                else
                                {
                                    $cocher='';
                                }
                                echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2['lib_privilege'].'</option>';
                            }
                            ?>
                          </select>
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'agences':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=addslashes(($_POST['nom']));
								$ville=addslashes(($_POST['ville']));
								$longitude=addslashes(($_POST['longitude']));
								$latitude=addslashes(($_POST['latitude']));
								$pays=addslashes(($_POST['pays']));
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le nom</div>';
								}
								elseif (empty($ville))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner la ville</div>';
								}
								elseif (empty($pays))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner la pays</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", ville_'.$chaiz.'="'.$ville.'", longitude_'.$chaiz.'="'.$longitude.'", latitude_'.$chaiz.'="'.$latitude.'", id_pays='.$pays.' WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_agences`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Nom</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
							<h5>Ville</h5>
							<input type="text" class="form-control" name="ville" value="<?php echo stripslashes($data['ville_'.$chaiz.'']) ?>">
							<h5>Longitude</h5>
							<input type="text" class="form-control" name="longitude" value="<?php echo stripslashes($data['longitude_'.$chaiz.'']) ?>">
							<h5>Latitude</h5>
							<input type="text" class="form-control" name="latitude" value="<?php echo stripslashes($data['latitude_'.$chaiz.'']) ?>">
                            <h5>Pays</h5>
                            <select name="pays" class="form-control">
							<?php
                            $sql2 = "SELECT * FROM pays ORDER BY nom_fr_fr ASC";
                            $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                            while ($data2 =$reponse2->fetch()) 
                            {
                                if ($data2[0]==$data['id_pays'])
                                {
                                    $cocher='selected';
                                }
                                else
                                {
                                    $cocher='';
                                }
                                echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2['nom_fr_fr'].'</option>';
                            }
                            ?>
                          </select>
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'commune':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'" WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_commune`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'privilege':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$visible=(addslashes($_POST['visible']));
								$afficher=(addslashes($_POST['afficher']));
								$position=(addslashes($_POST['position']));
								$fa=addslashes(($_POST['fa']));
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								elseif (empty($afficher))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le nom à afficher dans l\'administration</div>';
								}
								elseif($visible=='')
								{
									echo '<div class="alert alert-danger">Veuillez renseigner la visibilité</div>';
								}
								elseif ($position=='')
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le positionnement</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", position_'.$chaiz.'="'.$position.'", afficher_'.$chaiz.'="'.$afficher.'", visible_'.$chaiz.'="'.$visible.'", fa_'.$chaiz.'="'.$fa.'" WHERE id_'.$chaiz.'='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_privilege`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
                        	<h5>Affichage dans l'administration</h5>
							<input type="text" class="form-control" name="afficher" value="<?php echo stripslashes($data['afficher_'.$chaiz.''])?>">
                        	<h5>positionement <span id="span_privilege">utilisateur/parametre/visiteur/droite</span></h5>
							<input type="text" class="form-control" name="position" value="<?php echo stripslashes($data['position_'.$chaiz.'']) ?>">
                            <h5>Visible dans l'ajout d'utilisateur</h5>
							<input type="text" class="form-control" name="visible" value="<?php echo stripslashes($data['visible_'.$chaiz.'']) ?>">
							<h5>Icone font awesone</h5>
							<input type="text" class="form-control" name="fa" value="<?php echo stripslashes($data['fa_'.$chaiz.'']) ?>">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'champ':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'" WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_champ`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'type_slider':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=addslashes(($_POST['nom']));
								$width=addslashes(($_POST['width']));
								$height=addslashes(($_POST['height']));
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								elseif (empty($width))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner la largeur</div>';
								}
								elseif (empty($height))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner la hauteur</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", width_'.$chaiz.'="'.$width.'", height_'.$chaiz.'="'.$height.'" WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_type_slider`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
							<h5>Largeur</h5>
							<input type="text" class="form-control" name="width" value="<?php echo stripslashes($data['width_'.$chaiz.'']) ?>">
							<h5>Longueur</h5>
							<input type="text" class="form-control" name="height" value="<?php echo stripslashes($data['height_'.$chaiz.'']) ?>">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'langue':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
					
								$name_img=$_FILES['tof']['name'];
								$type_img=$_FILES['tof']['type'];
								$size_img=$_FILES['tof']['size'];
								$temp_img=$_FILES['tof']['tmp_name'];
								$error_img=$_FILES['tof']['error'];
								
								$extension=strrchr($name_img,'.');
								$date_mise=date('Y-m-d H:i:s');

								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								else
								{
									if ($error_img==0)
									{
										if ($extension=='.jpg' or $extension=='.png' or $extension=='.jpeg' or $extension=='.gif' or $extension=='.bmp' or $extension=='.JPG' or $extension=='.PNG' or $extension=='.JPEG' or $extension=='.GIF' or $extension=='.BMP')
										{
											$lien_img=$date_img.'777ng_koben'.$extension;
											move_uploaded_file($temp_img, "../upload/".$lien_img);
										}
										else
										{
											echo '<div class="alert alert-danger">Format Incorrect </div>';
											?> 
											<script type="text/javascript">
                                            window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",0);
                                            </script>
                                            <?php
											exit;
										}
									}
									else
									{
										$lien_img=$data['img_'.$chaiz.''];
									}
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", img_'.$chaiz.'="'.$lien_img.'" WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_langue`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
                            <img src="../upload/<?php echo $data['img_'.$chaiz.''] ?>" id="float_img">
                            <input type="file" class="form-control" name="tof">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						case 'coordonnee':
						if($developpeur==1)
						{
							?>
							<div id="afficher_admin">
								<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
									<i class="fa fa-pencil"></i> Ajouter
								</a>
							</div>
							<?php
						}
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'='.$id;
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=stripslashes(($_POST['nom']));
								$valeur=stripslashes(($_POST['valeur']));
								$date_mise=date('Y-m-d H:i:s');
								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								elseif (empty($valeur))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner: '.$data['lib_'.$chaiz.''].'</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", valeur_'.$chaiz.'="'.$valeur.'" WHERE id_'.$chaiz.'='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_'.$chaiz.'`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<div>
                                <h5>Titre</h5>
                                <input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
                            </div>
                            <h5><?php echo stripslashes($data['lib_'.$chaiz.'']) ?></h5>
							<input type="text" class="form-control" name="valeur" value="<?php echo stripslashes($data['valeur_'.$chaiz.'']) ?>">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;
						
						case 'agence':
						if($developpeur==1)
						{
							?>
							<div id="afficher_admin">
								<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
									<i class="fa fa-pencil"></i> Ajouter
								</a>
							</div>
							<?php
						}
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'='.$id;
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$present=(addslashes($_POST['present']));
								
								if(isset($_SESSION['langue']))
								{
									$sql2='SELECT * FROM agence, langue WHERE langue.id_langue=agence.id_langue AND id_'.$chaiz.'="'.$id.'"';
									$reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
									while($data2=$reponse2->fetch())
									{
										if($data2[0]!=NULL)
										{
											$langue=(addslashes($_POST['langue']));
										}
										else
										{
											$langue='NULL';
										}
									}
								}
								else
								{
									$langue='NULL';
								}
								$name_img=$_FILES['tof']['name'];
								$type_img=$_FILES['tof']['type'];
								$size_img=$_FILES['tof']['size'];
								$temp_img=$_FILES['tof']['tmp_name'];
								$error_img=$_FILES['tof']['error'];
								
								$extension=strrchr($name_img,'.');
								$date_mise=date('Y-m-d H:i:s');

								if (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le titre</div>';
								}
								else
								{
									//avoir l'url
									$url=strtolower(str_replace($suppression, $ajouter, $nom));
									if ($error_img==0)
									{
										if ($extension=='.jpg' or $extension=='.png' or $extension=='.jpeg' or $extension=='.gif' or $extension=='.bmp' or $extension=='.JPG' or $extension=='.PNG' or $extension=='.JPEG' or $extension=='.GIF' or $extension=='.BMP')
										{
											$lien_img=$date_img.'777ng_koben'.$extension;
											move_uploaded_file($temp_img, "../upload/".$lien_img);
										}
										else
										{
											echo '<div class="alert alert-danger">Format Incorrect </div>';
											?> 
											<script type="text/javascript">
                                            window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",3000);
                                            </script>
                                            <?php
											break;
										}
									}
									else
									{
										$lien_img=$data['img_'.$chaiz.''];
									}
									$req='UPDATE '.$chaiz.' SET lib_'.$chaiz.'="'.$nom.'", descrip_'.$chaiz.'="'.$present.'", url_'.$chaiz.'="'.$url.'", img_'.$chaiz.'="'.$lien_img.'", id_langue='.$langue.' WHERE id_'.$chaiz.'='.$id;
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_agence`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Titre</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>">
                            <?php
							$sql2='SELECT * FROM agence, langue WHERE langue.id_langue=agence.id_langue AND id_'.$chaiz.'="'.$id.'"';
							$reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
							while($data2=$reponse2->fetch())
							{
								if($data2[0]!=NULL)
								{
									?>
                                    <h5>Langue</h5>
									<select name="langue" class="form-control">
									<?php
									$sql2 = "SELECT * FROM langue ORDER BY lib_langue ASC";
									$reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
									while ($data2 =$reponse2->fetch()) 
									{
										if ($data2[0]==$data['id_langue'])
										{
											$cocher='selected';
										}
										else
										{
											$cocher='';
										}
										echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2[1].'</option>';
									}
									?>
									</select>
									<?php
								}
							}
							?>
                        	<h5>Description</h5>
							<textarea class="form-control" id="present" name="present"><?php echo stripslashes($data['descrip_'.$chaiz.'']) ?></textarea>
                            <script>
								CKEDITOR.replace('present');
							</script>
                            <h5>Image</h5>
                            <?php
                            if($data['img_'.$chaiz.'']!='')
							{
								$limg='<img src="../upload/'.$data['img_'.$chaiz.''].'" id="float_img">';
							}
							else
							{
								$limg='<img src="img/noimage.png" id="float_img">';
							}
							echo $limg
							?>
                            <input type="file" class="form-control" name="tof">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;
						
						case 'slider':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<?php
						$sql= 'SELECT * FROM '.$chaiz.' WHERE id_'.$chaiz.'="'.$id.'"';
						$reponse=$bdd->query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						$data=$reponse->fetch();
						?>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$nom=(addslashes($_POST['nom']));
								$dimension=(addslashes($_POST['dimension']));

								$name_img=$_FILES['tof']['name'];
								$type_img=$_FILES['tof']['type'];
								$size_img=$_FILES['tof']['size'];
								$temp_img=$_FILES['tof']['tmp_name'];
								$error_img=$_FILES['tof']['error'];
								
								$extension=strrchr($name_img,'.');
								$date_mise=date('Y-m-d H:i:s');

								if ($nom=='kjh')
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le lien</div>';
								}
								else
								{
									if ($error_img==0)
									{
										if ($extension=='.jpg' or $extension=='.png' or $extension=='.jpeg' or $extension=='.gif' or $extension=='.bmp' or $extension=='.JPG' or $extension=='.PNG' or $extension=='.JPEG' or $extension=='.GIF' or $extension=='.BMP')
										{
											$sql2 = 'SELECT * FROM type_slider WHERE id_type_slider='.$dimension.'';
											$reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
											$data2 =$reponse2->fetch();
											
											$size2=getimagesize($temp_img);
											$width=$size2[0];
											$height=$size2[1];
											if($width==$data2['width_type_slider'] and $height==$data2['height_type_slider'])
											{
												$lien_img=$date_img.'777ng_koben'.$extension;
												move_uploaded_file($temp_img, "../upload/".$lien_img);
											}
											else
											{
												echo '<div class="alert alert-danger">Respectez les dimensions de l\'image ('.$data2['width_type_slider'].'x'.$data2['height_type_slider'].') !</div>';
												?> 
												<script type="text/javascript">
                                                window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",3000);
                                                </script>
                                                <?php
												break;
											}
										}
										else
										{
											echo '<div class="alert alert-danger">Format de l\'image Incorrect !</div>';
											?> 
											<script type="text/javascript">
                                            window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",3000);
                                            </script>
                                            <?php
											break;
										}
									}
									else
									{
										$lien_img=$data['img_'.$chaiz.''];
									}
									$req='UPDATE '.$chaiz.' SET lien_'.$chaiz.'="'.$nom.'", img_'.$chaiz.'="'.$lien_img.'" WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur(`id_modificateur`, `id_slider`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success"> Modification effectuée avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
							<h5>Lien web</h5>
							<input type="text" class="form-control" name="nom" value="<?php echo stripslashes($data['lien_'.$chaiz.'']) ?>">
                            <h5>Type de slider</h5>
                            <select name="dimension" class="form-control">
							<?php
                            $sql2 = "SELECT * FROM type_slider ORDER BY lib_type_slider ASC";
                            $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                            while ($data2 =$reponse2->fetch()) 
                            {
                                if ($data2[0]==$data['id_type_slider'])
                                {
                                    $cocher='selected';
                                }
                                else
                                {
                                    $cocher='';
                                }
                                echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2['lib_type_slider'].' ('.$data2['width_type_slider'].'x'.$data2['height_type_slider'].')</option>';
                            }
                            ?>
							</select>
                            <h5>Image</h5>
                            <?php
                            if($data['img_'.$chaiz.'']!='')
							{
								$limg='<img src="../upload/'.$data['img_'.$chaiz.''].'" id="float_img">';
							}
							else
							{
								$limg='<img src="../img/noimage.png" id="float_img">';
							}
							echo $limg
							?>
                            <input type="file" class="form-control" name="tof">
							<div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;
						
						case 'membre':
						?>
						<div id="afficher_admin">
							<a class="btn btn-primary" href="inscriptionby.php">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
						<div align="center">
							<?php
							if (isset($_POST['valider']))
							{
								$pseudo=addslashes(($_POST['pseudo']));
								$nom=addslashes(($_POST['nom']));
								$prenom=addslashes(($_POST['prenom']));
								$sexe=addslashes(($_POST['sexe']));
								$pays=addslashes(($_POST['pays']));
								$ville=addslashes(($_POST['ville']));
								$tel=addslashes(($_POST['tel']));
								$mail=addslashes(($_POST['mail']));
								$creation=addslashes(($_POST['creation']));
								$mat_parrain=addslashes(($_POST['mat_parrain']));
								if($data['date_filleul']!=NULL)
								{
									$date_filleul=addslashes(($_POST['date_filleul']));
								}
								else
								{
									$date_filleul=NULL;
								}
								$date_mise=date('Y-m-d H:i:s');
								
								$sql2= 'SELECT count(*) FROM membre WHERE pseudo_membre="'.$pseudo.'"';
								$reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
								$data2=$reponse2->fetch();
								$nbr_pseudo=$data2[0];
								
								if (empty($pseudo))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le pseudo</div>';
								}
								elseif (empty($nom))
								{
									echo '<div class="alert alert-danger">Veuillez choisir le nom</div>';
								}
								elseif (empty($prenom))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le prénom</div>';
								}
								elseif (empty($sexe))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le sexe</div>';
								}
								elseif (empty($pays))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le pays</div>';
								}
								elseif (empty($mat_parrain))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le parrain</div>';
								}
								elseif (empty($tel))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le numéro de téléphone</div>';
								}
								elseif (empty($mail))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner le mail</div>';
								}
								elseif (empty($ville))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner la ville</div>';
								}
								elseif (empty($creation))
								{
									echo '<div class="alert alert-danger">Veuillez renseigner la date d\'inscription</div>';
								}
								elseif (empty($date_filleul) and $data['date_filleul']!=NULL)
								{
									echo'<div class="alert alert-danger">Veuillez renseigner la date d\'inscription du dernier filleul</div>';
								}
								if ($nbr_pseudo>1)
								{
									echo '<div class="alert alert-danger">Ce pseudo existe déjà</div>';
								}
								elseif (!filter_var($mail, FILTER_VALIDATE_EMAIL))
								{
									echo '
									<div class="alert alert-danger">
										<strong>Erreur!</strong> Votre E-mail n\'est pas valide
									</div>';
								}
								else
								{
									$req='UPDATE '.$chaiz.' SET pseudo_'.$chaiz.'="'.$pseudo.'", nom_'.$chaiz.'="'.$nom.'", prenom_'.$chaiz.'="'.$prenom.'", tel_'.$chaiz.'="'.$tel.'", ville_'.$chaiz.'="'.$ville.'", sexe_'.$chaiz.'="'.$sexe.'", modif_'.$chaiz.'="'.$date_mise.'", creation_'.$chaiz.'="'.$creation.'", id_modif_user='.$_SESSION['celest'].', id_parain='.$mat_parrain.', id_pays='.$pays.', nombre_modif='.($data['nombre_modif']+1).' WHERE id_'.$chaiz.'='.$id.'';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									
									$req='INSERT INTO modificateur (`id_modificateur`, `id_membre`, `id_modif_user`, `date_modificateur`) VALUES (NULL, '.$id.', '.$_SESSION['celest'].', "'.$date_mise.'")';
									$reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
									echo '<div class="alert alert-success">Ajout effectué avec succès</div>';
									?> 
									<script type="text/javascript">
									window.setTimeout("location=('modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz; ?>&QYtgoGbhhd=<?php echo $id; ?>');",2500);
									</script>
									<?php
								}
							}			
							?>
						</div>
						<form role="form" method="post" action="" enctype="multipart/form-data" name="form2">
                            Matricule
                            <input class="form-control" type="text" name="matricule" value="<?php echo stripslashes($data['matricule_'.$chaiz]) ?>" disabled>
                            Pseudo *
                            <input class="form-control" type="text" name="pseudo" value="<?php echo stripslashes($data['pseudo_'.$chaiz]) ?>" required>
                            Nom *
                            <input class="form-control" type="text" name="nom" value="<?php echo stripslashes($data['nom_'.$chaiz]) ?>" required>
                            Prénoms *
                            <input class="form-control" type="text" name="prenom" value="<?php echo stripslashes($data['prenom_'.$chaiz]) ?>" required>
                            Sexe *
                            <select name="sexe" class="form-control">
                                <option value="">--------------</option>
                                <option value="M"<?php if($data['sexe_'.$chaiz]=='M'){ echo ' selected'; } ?>>Homme</option>
                                <option value="F"<?php if($data['sexe_'.$chaiz]=='F'){ echo ' selected'; } ?>>Femme</option>
                            </select>
                            Pays *
                            <select name="pays" class="form-control">
                                <?php
                                $sql2 = "SELECT * FROM pays ORDER BY nom_fr_fr ASC";
                                $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                                while ($data2 =$reponse2->fetch())
                                {
                                   if ($data2[0]==$data['id_pays'])
									{
										$cocher='selected';
									}
									else
									{
										$cocher='';
									}
									echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2['nom_fr_fr'].'</option>';
                                }
                                ?>
                            </select>
                            Ville *
                            <input placeholder="" class="form-control" type="text" name="ville" value="<?php echo stripslashes($data['ville_'.$chaiz]) ?>" required>
                            Téléphone * <span id="obligatoire">Ecrivez sans l'indice de votre pays Exemple: 08972260</span>
                            <input placeholder="08972260" class="form-control" type="text" name="tel" value="<?php echo stripslashes($data['tel_'.$chaiz]) ?>" required>
                            Email *
                            <input placeholder="" class="form-control" type="text" name="mail" value="<?php echo stripslashes($data['mail_'.$chaiz]) ?>" required>
                            Matricule parrain*
                            <select name="mat_parrain" class="form-control">
                                <?php
                                $sql2 = 'SELECT * FROM membre WHERE id_membre<>'.$id.' ORDER BY matricule_membre ASC';
                                $reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                                while ($data2 =$reponse2->fetch())
                                {
                                   if ($data2[0]==$data['id_parain'])
									{
										$cocher='selected';
									}
									else
									{
										$cocher='';
									}
									echo '<option value="'.$data2[0].'" '.$cocher.'>'.$data2['matricule_membre'].'</option>';
                                }
                                ?>
                            </select>
                            Date d'inscription (veuillez respecter le format <span id="span">"01-01-2017"</span>) *
                            <?php include('datetime-membre.php'); ?>
                            <input class="form-control" type="text" id="datetimepicker7" name="creation" value="<?php echo date("d-m-Y", strtotime($data['creation_'.$chaiz.''])); ?>"/>
                            <?php
                            if($data['date_filleul']!=NULL)
							{
								?>
								Date inscription du dernier filleul *
                                <input class="form-control" type="text" id="datetimepicker7" name="date_filleul" value="<?php echo date("d-m-Y", strtotime($data['date_filleul'])); ?>"/>
								<?php
							}
							?>
                            <div id="valider">
								<input type="submit" class="btn btn-primary" value="Valider" name="valider">
								&nbsp; <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>"><i class="fa fa-reply"></i> Retour</a>
							</div>
						</form>
	                    <?php
						break;

						default: header('administration.php');
					}
					?>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

<?php
}
else
{
	header('Location: index.php');
}
?>