//*************************************************************** include "fck_config_serveur.php"; include "fonctions.inc"; $nom_page="index.php"; htmlEntete($nomsite); include "connexion.php"; if (isset($_POST["addPage"])) { $sql = "INSERT INTO pages SET " ."paTitre='".ereg_replace("'",""",$_POST['page'])."', " ."paIDMenu='".$_POST['idMenu']."', " ."Actif=1, " ."Ordre=".(mysqlGetMax2("pages", "Ordre", "WHERE paIDMenu=".$_POST['idMenu']) + 1).""; mysql_query($sql); header("location:index.php".(($_GET["idPage"]>1) ? '?idPage='.$_GET["idPage"] : '')); } if (isset($_POST["addBloc"])) { $sql = "INSERT INTO menus SET " ."meTitre='".ereg_replace("'",""",$_POST['bloc'])."', " ."Actif=1, " ."Ordre=".(mysqlGetMax2("menus", "Ordre", "") + 1).""; mysql_query($sql); header("location:index.php".(($_GET["idPage"]>1) ? '?idPage='.$_GET["idPage"] : '')); } if ($_POST["idBlocAModif"]>0) { $sql = "UPDATE menus SET " ."meTitre='".ereg_replace("'",""",$_POST['bloc'])."', " ."Actif = ".(($_POST['actif']==1) ? '1' : '0')." " ."WHERE meID=".$_POST["idBlocAModif"]; mysql_query($sql); // pour gérer l'ordre if ($_POST["menuPos"]>0) { $sqlMenu="SELECT * FROM menus WHERE meID<>".$_POST["idBlocAModif"]." ORDER BY Ordre"; $rsMenu=mysql_query($sqlMenu); $ordre=1; while ($lM2=mysql_fetch_assoc($rsMenu)) { $sql = "UPDATE menus SET " ."Ordre='".$ordre."' " ."WHERE meID=".$lM2["meID"]; mysql_query($sql); $ordre++; if ($lM2["meID"]==$_POST["menuPos"]) { $sql = "UPDATE menus SET " ."Ordre='".$ordre."' " ."WHERE meID=".$_POST["idBlocAModif"]; mysql_query($sql); $ordre++; } } } header("location:index.php".(($_GET["idPage"]>1) ? '?idPage='.$_GET["idPage"] : '')); } if ($_POST["idBlocASuppr"]>0) { $sql = "DELETE FROM pages WHERE paIDMenu=".$_POST["idBlocASuppr"]; mysql_query($sql); $sql = "DELETE FROM menus WHERE meID=".$_POST["idBlocASuppr"]; mysql_query($sql); header("location:index.php"); } // Initialisation if (!isset($_GET["idPage"])) $_GET["idPage"]=1; if (!isset($_GET["imprim"])) $imprim=0; else $imprim=$_GET["imprim"]; htmlBody((($imprim==1) ? ' onLoad="window.print();" ' : '')); bandeau_haut(); if (($_SESSION['connect']==1)) { echo '
'; } ?>