<?php require_once "../inc/init.inc.php"; if (!utilisateurEstConnecteEtEstAdmin()) { header("location:../noadmin.php"); } else { require_once "../inc/header.inc.php"; require_once "../inc/menu.inc.php"; } echo '<div class="affichage">Gestion Code Promos</div>'; ?> <form name="codepromo" method="post" action=""> <label for="valeurpromo">Promotion :</label><br> <input name="valeurpromo" type="text"> %<br> <input name="gencode" type="submit" value="Générer"> </form> <?php if (isset($_GET['action']) && $_GET['action'] == "suppression") { executeRequete("DELETE FROM promotion WHERE id_promo = {$_GET['id_promo']}"); $_GET['action'] = 'affichage'; } if (isset($_POST['gencode'])) { if ($_POST['valeurpromo'] == 0 || empty($_POST['valeurpromo'])) { $msg .= "<div class='error'>Votre code promo ne peut pas être égal à zéro.</div>"; } else { $codepromo = 'PROMO'; $codepromo .= substr(uniqid(rand(), true), 0, 10); $savecodepromo = executeRequete("INSERT INTO promotion (code_promo, reduction) VALUES ('{$codepromo}', '{$_POST['valeurpromo']}')"); $msg .= "<div class='primiere'>Code promo généré.</div>"; }
if (utilisateurEstConnecte()) { echo '<li><a href="' . RACINE_SITE . 'connexion.php?action=deconnexion">déconnexion</a></li>'; } else { echo '<li><a '; if ($titre_page == 'Inscription') { echo 'class="active"'; } echo ' href="' . RACINE_SITE . 'inscription.php">inscription</a></li> <li><a '; if ($titre_page == 'Connexion') { echo 'class="active"'; } echo ' href="' . RACINE_SITE . 'connexion.php">connexion</a></li>'; } echo '</ul>'; if (utilisateurEstConnecteEtEstAdmin() || utilisateurEstConnecteEtEstGerantEtAdmin()) { echo '<ul> <li><a class="admin no_border '; if ($titre_page == 'Gestion des commandes') { echo 'active'; } echo '" href="' . RACINE_SITE . 'admin/gestion_commandes.php?orderby=id_commande&affichage=affichage&action=commandes&desc=desc">commandes</a></li> <li><a class="admin no_border '; if ($titre_page == 'Gestion des produits') { echo 'active'; } echo '" href="' . RACINE_SITE . 'admin/gestion_produit.php?orderby=id_produit&affichage=affichage&desc=desc">produits</a></li> <li><a class="admin no_border '; if ($titre_page == 'Gestion des membres') { echo 'active'; }
<?php require_once "../inc/init.inc.php"; $titre_page = "Gestion des avis"; ////////APERO - Felicia Cuneo - 01/2016 //Redirection si l'utilisateur n'est pas admin if (!utilisateurEstConnecteEtEstAdmin() && !utilisateurEstConnecteEtEstGerantEtAdmin()) { header("location:../connexion.php"); } // SUPPRESSION DES AVIS if (isset($_GET['action']) && $_GET['action'] == 'suppression') { $id = filter_input(INPUT_GET, 'id_avis', FILTER_SANITIZE_NUMBER_INT); $resultat = executeRequete("SELECT * FROM avis WHERE id_avis = '{$id}'"); //on recupere les infos dans la table avis executeRequete("DELETE FROM avis WHERE id_avis='{$id}'"); $msg .= '<div class="msg_success"><h4>Avis N°' . $id . ' supprimé!</h4></div>'; //suppression de l'avis dans la table + affichage d'un msg de confirmation } $req = ""; require_once "../inc/header.inc.php"; ?> <?php $resultat = executeRequete("SELECT SUM(montant) AS total,\n\t\t\t\t\t\t\t\t\t\tCOUNT(id_commande) AS nbre_commandes,\n\t\t\t\t\t\t\t\t\t\tROUND(AVG(montant),2) AS panier_moyen,\n\t\t\t\t\t\t\t\t\t\tMAX(date) AS der_commande \n\t\t\t\t\t\t\t\t\tFROM commande"); $commandes = $resultat->fetch_assoc(); //<div class="box_info"> echo '<h3>CA Total : ' . $commandes['total'] . '€ | Nombre de commandes: ' . $commandes['nbre_commandes'] . ' | Commande moyenne : ' . $commandes['panier_moyen'] . '€</h3><br />'; echo $msg; echo '<br />'; echo '<h2 class="orange">Tous les avis</h2>
<?php if (utilisateurEstConnecteEtEstAdmin()) { echo '<li><a href="' . RACINE_SITE . 'admin/gestion_salles.php">Gestion des Salles</a></li>'; echo '<li><a href="' . RACINE_SITE . 'admin/gestion_membre.php">Gestion des Membre</a></li>'; echo '<li><a href="' . RACINE_SITE . 'admin/gestion_produits.php">Gestion des Produits</a></li>'; echo '<li><a href="' . RACINE_SITE . 'admin/gestion_commande.php">Gestion des Commandes</a></li>'; echo '<li><a href="' . RACINE_SITE . 'admin/gestion_avis.php">Gestion des Avis</a></li>'; echo '<li><a href="' . RACINE_SITE . 'admin/gestion_promos.php">Gestion codes Promo</a></li>'; echo '<li><a href="' . RACINE_SITE . 'admin/statistiques.php">Statistiques</a></li>'; echo '<li><a href="' . RACINE_SITE . 'admin/newsletter.php">Envoyer la newsletter</a></li>'; } if (utilisateurEstConnecte() && isset($_GET['action']) && $_GET['action'] == 'deconnexion') { session_destroy(); header("location:" . RACINE_SITE . "connexion.php"); } if (utilisateurEstConnecteEtEstAdmin() && isset($_GET['action']) && $_GET['action'] == 'deconnexion') { session_destroy(); header("location:" . RACINE_SITE . "connexion.php"); } ?> </ul> </div> <div class="fix main_content_area"> <div class="fix slider_area"> <div class="fix slider_top_border"></div> <div class="slider"> <!-- Jssor Slider Begin --> <!-- You can move inline styles to css file or css block. --> <div id="slider1_container" style="position: relative; width: 980px;height: 300px;">