<?php
session_start();
include('../connexion.php');
if (!isset($_SESSION['celest']))
{
	header ('Location: index.php');
}
if (isset($_GET['W9mvyDvFWE5']))
{
	$chaiz=addslashes($_GET['W9mvyDvFWE5']);
	require_once('active.php');	
	$sql2 = 'SELECT COUNT(*) as nbr FROM '.$chaiz.'';
	$reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
	$data2 =$reponse2->fetch();
	?>
	<?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-12" id="administration">
                	<?php
                    $sql='SELECT * FROM privilege WHERE lib_privilege="'.$chaiz.'"';
					$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
					$data=$reponse->fetch();
					$afficher=stripslashes($data['afficher_privilege']);
					?>
                	<div id="titro_admin">Gestionnaire : <?php echo $afficher ?> <span>(<?php echo $data2[0]?>)</span></div>
                    <!--<?php
                    if($chaiz!='contact')
					{
					?>
                    <div id="add_admin">
                    	<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
                        	<i class="fa fa-pencil"></i> Ajouter
                        </a>
                    </div>
                    <?php
					}
					?>-->
                    <table width="100%" class="table table-bordered table-condensed table-hover table-striped" id="tableau">
                    <?php
					$i=0;
					switch($chaiz)
					{
						case 'visiteur': $i=1;
						break;
						case 'type':;
						?>
						<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php
                                        echo stripslashes($data['lib_'.$chaiz.'']);
                                        
                                        $sql2 = 'SELECT COUNT(*) FROM selection_type, type WHERE type.id_type=selection_type.id_type AND type.id_'.$chaiz.'="'.$data[0].'"';
                                        $reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                                        $data2 =$reponse2->fetch();
                                        echo ' <span>('.$data2[0].')</span>';
                                        ?>
                                    </a> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<?php echo $data[0] ?>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'user':;
						?>
						<div id="add_admin">
                            <a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
                                <i class="fa fa-pencil"></i> Ajouter
                            </a>
                        </div>
                        <?php
						if($developpeur==1)
						{
							$sql='SELECT * FROM '.$chaiz.', type_user WHERE type_user.id_type_user=user.id_type_user ORDER BY id_'.$chaiz.' DESC';
						}
						else
						{
							$sql='SELECT * FROM '.$chaiz.', type_user WHERE type_user.id_type_user<>1 AND  type_user.id_type_user=user.id_type_user ORDER BY id_'.$chaiz.' DESC';
						}
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php
                                        echo stripslashes($data['lib_'.$chaiz.'']).' : '.stripslashes($data['lib_type_user']);
                                        
                                        $sql2 = 'SELECT COUNT(*) FROM user_privilege, user WHERE user.id_user=user_privilege.id_user AND user.id_'.$chaiz.'='.$data[0];
                                        $reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                                        $data2 =$reponse2->fetch();
										
                                        $sql3 = 'SELECT COUNT(*) FROM user_type, user WHERE user.id_user=user_type.id_user AND user.id_'.$chaiz.'='.$data[0];
                                        $reponse3=$bdd->query($sql3) or die('Erreur SQL !<br />'.$sql3.'<br />'.mysql_error());
                                        $data3=$reponse3->fetch();
										$somme=$data2[0] + $data3[0];
										if($developpeur==1)
										{
                                        	echo ' <span>('.$somme.')</span>';
										}
                                        ?>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'typeinfo':
						?>
						<div id="add_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.', type WHERE type.id_type='.$chaiz.'.id_type ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php echo stripslashes($data['lib_'.$chaiz.''].'<span>('.$data['lib_type'].')</span>') ?>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'categorie':
						?>
						<div id="add_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.', type, typeinfo WHERE typeinfo.id_typeinfo='.$chaiz.'.id_typeinfo AND type.id_type='.$chaiz.'.id_type ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php echo stripslashes($data['lib_'.$chaiz.''].'<span>('.$data['lib_type'].' <i class="fa fa-caret-right"></i> '.$data['lib_typeinfo'].')</span>') ?>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'newsletter':;
						?>
						<div id="add_admin">
                            <a class="btn btn-primary" href="envoyer-mail.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
                                <i class="fa fa-pencil"></i> Envoyer mail
                            </a>
                        </div>
                        <?php
						$sql='SELECT * FROM '.$chaiz.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
									<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'selection':
						?>
						<div id="add_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.', champ WHERE champ.id_champ=selection.id_champ ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
									<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>
                                        <span>(<?php echo $data['lib_champ'] ?>)</span>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'champ':
						case 'type_user':
						?>
						<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'type_slider':
						?>
						<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>
                                        <span id="span"> (<?php echo stripslashes($data['width_'.$chaiz.'']) ?>x<?php echo stripslashes($data['height_'.$chaiz.'']) ?>)</span>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'privilege':;
						?>
						<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php echo stripslashes($data['lib_'.$chaiz.'']).' (<span>'.$data['position_'.$chaiz.''].'</span>)' ?>
                                    </a>
								</td>
                                <td id="td2">
									<?php
                                    if($data['visible_'.$chaiz.'']==1)
                                    {
                                        echo '<a href="?num='.$data[0].'&disponibilite=0&W9mvyDvFWE5='.$chaiz.'"><img src="img/valid.png" width="20"></a>';
                                    }
                                    else
                                    {
                                        echo '<a href="?num='.$data[0].'&disponibilite=1&W9mvyDvFWE5='.$chaiz.'"><img src="img/attention.png" width="20"></a>';
                                    }
                                    if(isset($_GET['disponibilite']))
                                    {
                                        $disponibilite=addslashes(($_GET['disponibilite']));						
                                        $num=addslashes(($_GET['num']));						
                                        $req='UPDATE '.$chaiz.' SET visible_'.$chaiz.'="'.$disponibilite.'" WHERE id_'.$chaiz.'="'.$num.'"';
                                        $reponse=$bdd-> query($req) or die('Erreur SQL !<br />'.$req.'<br />'.mysql_error());
                                        ?>
                                        <script type="text/javascript">window.setTimeout("location=('gestionnaire-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>#visiblilite<?php echo $i ?>');",0);</script>
                                        <?php
                                    }
                                    ?>
                                </td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'commune':;
						?>
						<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'langue':;
						?>
						<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                    <a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<img src="../upload/<?php echo $data['img_'.$chaiz.''] ?>" width="100">
                                    	<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'coordonnee':;
						if($developpeur==1)
						{
							?>
							<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<?php echo stripslashes($data['lib_'.$chaiz.'']) ?>: <?php echo stripslashes($data['valeur_'.$chaiz.'']) ?>
                                    </a>
								</td>
								<td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
                                <?php
                                if($data10['role_user']=='superadmin')
								{
								?>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
                                <?php
								}
								?>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'slider':;
						?>
						<div id="add_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.', type_slider WHERE type_slider.id_type_slider=slider.id_type_slider ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td id="td0">
									<?php echo $i ?>
								</td>
								<td id="td1" align="left">
									<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<img src="../upload/<?php echo $data['img_'.$chaiz.''] ?>" class="img-responsive" width="300">
                                        <span id="span">(<?php echo $data['lib_type_slider'] ?> <?php echo $data['width_type_slider'] ?>x<?php echo $data['height_type_slider'] ?>)</span>
                                    </a>
								</td>
                                <td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'slider2':;
						?>
						<div id="add_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.', type_slider WHERE type_slider.id_type_slider=slider2.id_type_slider ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
		?>
							<tr align="center">
								<td id="td0">
									<?php echo $i ?>
								</td>
								<td id="td1" align="left">
									<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<img src="../upload/<?php echo $data['caroussel_'.$chaiz.''] ?>" class="img-responsive" width="300">
                                        <span id="span">(<?php echo $data['lib_type_slider'] ?> <?php echo $data['width_type_slider'] ?>x<?php echo $data['height_type_slider'] ?>)</span>
                                    </a>
								</td>
                                <td id="td2">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;

						case 'agence':
						if($developpeur==1)
						{
							?>
							<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                    	<?php
                                        $sql2='SELECT * FROM agence, langue WHERE langue.id_langue=agence.id_langue AND id_'.$chaiz.'="'.$data[0].'"';
										$reponse2=$bdd-> query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
										while($data2=$reponse2->fetch())
										{
											if($data2[0]!=NULL)
											{
												?>
												<img src="../upload/<?php echo $data2['img_langue'] ?>" width="20">
												<?php
											}
										}
										if($data['img_'.$chaiz.'']!='')
										{
											$limg='<img src="../upload/'.$data['img_'.$chaiz.''].'" width="100">';
										}
										else
										{
											$limg='<img src="img/noimage.png" width="100">';
										}
										echo $limg;
										?>
                                        
                                        <?php echo stripslashes($data['lib_'.$chaiz.'']) ?>
                                    </a>
								</td>
								<td id="td3">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
                                <?php
                                if($data10['id_type_user']==1)
								{
								?>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
                                <?php
								}
								?>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;
												
						case 'agent':
						?>
						<div id="add_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.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                    	<?php
                                        echo stripslashes($data['nom_'.$chaiz.''].' '.$data['prenom_'.$chaiz.'']);
										$sql2 = 'SELECT COUNT(*) FROM membre WHERE id_'.$chaiz.'='.$data[0];
                                        $reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                                        $data2 =$reponse2->fetch();
										echo ' <span id="span">[membres inscrits:'.$data2[0].']</span>';
										?>
                                    </a>
								</td>
								<td id="td3">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;
												
						case 'agences':
						?>
						<div id="add_admin">
							<a class="btn btn-primary" href="ajouter-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
                        <tr align="center"><td></td> <td></td> <td>Nbr agent</td> <td></td> <td></td> <td></td></tr>
						<?php
						$sql='SELECT * FROM '.$chaiz.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                    	<?php echo stripslashes($data['lib_'.$chaiz.'']);?>
                                    </a>
								</td>
                                <td id="td1">
									<?php
                                    $sql2 = 'SELECT COUNT(*) FROM agent WHERE id_'.$chaiz.'='.$data[0];
                                    $reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                                    $data2 =$reponse2->fetch();
                                    echo '<span id="span">['.$data2[0].']</span>';
                                    ?>
								</td>
								<td id="td3">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
								<td id="td3">
									<a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-trash-o fa-2x"></i>
									</a>
								</td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;
												
						case 'contact':
						$sql='SELECT * FROM '.$chaiz.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                        <?php echo stripslashes($data['lib_'.$chaiz.'']) ?> <span>"<?php echo $data['sujet_'.$chaiz.''] ?>"</span>
                                    </a>
								</td>
                                <td id="td3">
                                    <a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                        <i class="fa fa-trash-o fa-2x"></i>
                                    </a>
                                </td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;
						
						case 'inscription':
						$sql='SELECT * FROM '.$chaiz.', typeinfo WHERE typeinfo.id_typeinfo=inscription.id_typeinfo ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							switch($data['id_typeinfo'])
							{
								case 1: $page='../impression';
								break;
								case 2: $page='../impression-un';
								break;
								case 3: $page='../impression-deux';
								break;
							}
							$i++;
							?>
							<tr align="center">
								<td align="left" id="td0">
									<?php echo $i ?>
								</td>
								<td align="left" id="td1">
                                	<a href="<?php echo $page.'?id='.$data[0] ?>" target="_blank">
                                        <?php echo stripslashes($data['lib_'.$chaiz.'']); ?>
                                        <span>(<?php echo stripslashes($data['lib_typeinfo']); ?>)</span>
                                    </a>
								</td>
                                <td id="td3">
                                    <a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                        <i class="fa fa-trash-o fa-2x"></i>
                                    </a>
                                </td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;
						
						case 'membre':
						?>
                        <div id="add_admin">
							<a class="btn btn-primary" href="inscriptionby.php">
								<i class="fa fa-pencil"></i> Ajouter
							</a>
						</div>
                        <tr align="center"><td></td><td>Matricule</td><td>Pseudo</td><td>Nom & Prénoms</td><td>Tel</td><td>Nbr filleul</td><td>Pseudo parrain</td><td></td><td></td><td></td></tr>
                        <?php
						$sql='SELECT * FROM '.$chaiz.' ORDER BY id_'.$chaiz.' DESC';
						$reponse=$bdd-> query($sql) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
						while($data=$reponse->fetch())
						{
							$i++;
							?>
							<tr align="center">
								<td id="td0">
									<?php echo $i; ?>
								</td>
								<td id="td3">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                        <?php
                                        echo stripslashes($data['matricule_'.$chaiz]) ?>
                                    </a>
								</td>
                                <td id="td3">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                        <?php
                                        echo stripslashes($data['pseudo_'.$chaiz]) ?>
                                    </a>
								</td>
                                <td align="left" id="td1">
                                	<a href="afficher-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                        <?php
                                        echo stripslashes($data['nom_'.$chaiz.'']) ?> <?php echo stripslashes($data['prenom_'.$chaiz.'']);
										?>
                                    </a>
								</td>
                                <td id="td3">
									<?php echo stripslashes($data['tel_'.$chaiz.'']) ?>
								</td>
                                <td id="td3">
									<?php
                                    $sql2 = 'SELECT COUNT(*) FROM membre WHERE id_parain="'.$data[0].'"';
                                    $reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
                                    $data2 =$reponse2->fetch();
                                    echo ' <span id="span">('.$data2[0].')</span>';
                                    ?>
								</td>
                                <td id="td3">
									<?php
									if(!empty($data['id_parain']))
									{
										$sql2 = 'SELECT * FROM membre WHERE id_membre='.$data['id_parain'];
										$reponse2=$bdd->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.mysql_error());
										$data2 =$reponse2->fetch();
										echo ' <span id="span">('.$data2['pseudo_membre'].')</span>';
									}
									else
									{
										echo '<span id="span">Pas de parain</span>';
									}
                                    ?>
								</td>
                                <td id="td3">
									<a href="modifier-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
										<i class="fa fa-edit fa-2x"></i>
									</a>
								</td>
                                <td id="td3">
                                    <a href="supprimer-info.php?W9mvyDvFWE5=<?php echo $chaiz ?>&QYtgoGbhhd=<?php echo $data[0] ?>">
                                        <i class="fa fa-trash-o fa-2x"></i>
                                    </a>
                                </td>
								<td id="td4">
									<?php echo strftime("%d %B %Y %H:%M", strtotime($data['creation_'.$chaiz.''])) ?>
								</td>
							</tr>
							<?php
						}
						break;
						
						default: header('administration.php');

					}
					if($i==0)
					{
						echo '<div class="alert alert-danger" id="alert"><i class="fa fa-warning"></i> Pas de '.$afficher.'</div>';
					}
					?>
                    </table>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

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