File manager - Edit - /home/missmand/public_html/admin/page/editAccueil.php
Back
<?php include '../lib/init.php'; /** * Initialisation */ use Lib\Utilisateur; use Lib\Tool; use Lib\Action; $accueilId = 1; Utilisateur::ifConnect(); Action::ifIsset($accueilId,'accueil',BASEADMIN); $erreur = array(); $succes = array(); /** * Formulaire */ if(isset($_POST['edit'])){ /** * Variables de formulaire */ $chapo = $_POST['chapo']; $introduction = $_POST['introduction']; $video = $_POST['video']; $zone1 = $_POST['zone1']; $zone2 = $_POST['zone2']; $zone3 = $_POST['zone3']; $metaTitle = $_POST['metaTitle']; $metaDescription = $_POST['metaDescription']; /** * Erreurs */ if(empty($chapo)) array_push($erreur, 'Veuillez compléter le champ "Introduction chapô"'); if(empty($introduction)) array_push($erreur, 'Veuillez compléter le champ "Introduction ous-texte"'); if(empty($video)) array_push($erreur, 'Veuillez compléter le champ "Introduction vidéo"'); if(empty($zone1)) array_push($erreur, 'Veuillez compléter le champ "Zone 1"'); if(empty($zone2)) array_push($erreur, 'Veuillez compléter le champ "Zone 2"'); if(empty($zone3)) array_push($erreur, 'Veuillez compléter le champ "Zone 3"'); if(empty($metaTitle)) array_push($erreur, 'Veuillez compléter le champ "Méta title"'); if(empty($metaDescription)) array_push($erreur, 'Veuillez compléter le champ "Méta description"'); /** * Si aucune erreur alors */ if(empty($erreur)){ /** * Modification de la page d'accueil en base de donnée */ $sql = $bdd->prepare("UPDATE accueil SET accueilChanged = :changed, accueilChapo = :chapo, accueilIntroduction = :introduction, accueilVideo = :video, accueilZone1 = :zone1, accueilZone2 = :zone2, accueilZone3 = :zone3, accueilMetatitle = :metaTitle, accueilMetaDescription = :metaDescription WHERE accueilId = :accueilId "); $sql->execute(array( 'changed' => Tool::dateTime('Y-m-d H:i'), 'chapo' => $_POST['chapo'], 'introduction' => $_POST['introduction'], 'video' => $_POST['video'], 'zone1' => $_POST['zone1'], 'zone2' => $_POST['zone2'], 'zone3' => $_POST['zone3'], 'metaTitle' => $_POST['metaTitle'], 'metaDescription' => $_POST['metaDescription'], 'accueilId' => $accueilId ) ); /* Succès */ array_push($succes, 'Page d\'accueil enregistrée avec succès'); } } /* Information sur la page */ $sql = $bdd->query("SELECT * FROM accueil WHERE accueilId = $accueilId "); $data = $sql->fetchObject(); $chapo = $data->accueilChapo; $introduction = $data->accueilIntroduction; $video = $data->accueilVideo; $zone1 = $data->accueilZone1; $zone2 = $data->accueilZone2; $zone3 = $data->accueilZone3; $metaTitle = $data->accueilMetaTitle; $metaDescription = $data->accueilMetaDescription; ?> <!doctype html> <html lang="fr"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width; initial-scale=1;"> <title><?= TITLEBACK ?></title> <link rel="icon" type="image/png" href="<?= BASEADMIN ?>img/layout/favicon.png"> <link href="<?= BASEFRONT ?>js/scroll/scroll.css" rel="stylesheet" type="text/css"> <link href="<?= BASEADMIN ?>css/app.css" rel="stylesheet" type="text/css"> </head> <body> <main id="main"> <?php include '../include/menu.php'; ?> <div id="container"> <?php include '../include/header.php'; ?> <div id="contentTitre"> <h1>Modifier la page d'accueil</h1> </div> <div id="content"> <?php if(!empty($erreur)){ Tool::getMessage($erreur, 'erreur'); } if(!empty($succes)){ Tool::getMessage($succes, 'succes'); } ?> <form action="#header" method="post" enctype="multipart/form-data"> <label>Introduction vidéo *</label> <input type="text" name="video" value="<?= $video ?>" class="form-elem big"> <div class="form-legende"> Uniquement le code de la vidéo<br>ex : https://www.youtube.com/watch?v=<strong>imtPF2b2Q4M</strong><br>(la partie en gras) </div> <label>Introduction chapô *</label> <textarea name="chapo" class="form-elem big"><?= $chapo ?></textarea><br> <label>Introduction sous-texte *</label> <textarea name="introduction" class="form-elem big wysiwyg"><?= $introduction ?></textarea><br> <label>Zone 1 *</label> <textarea name="zone1" class="form-elem big wysiwyg"><?= $zone1 ?></textarea><br> <label>Zone 2 *</label> <textarea name="zone2" class="form-elem big wysiwyg"><?= $zone2 ?></textarea><br> <label>Zone 3 *</label> <textarea name="zone3" class="form-elem big wysiwyg"><?= $zone3 ?></textarea><br> <div class="form-bloc"> <h3>Référencement</h3> <label>Meta title *</label> <input type="text" name="metaTitle" value="<?= $metaTitle ?>" class="form-elem big"> <label>Meta description *</label> <input type="text" name="metaDescription" value="<?= $metaDescription ?>" class="form-elem big"> </div> <br> <button name="edit" type="submit" class="form-submit turquoise medium">Enregistrer</button> </form> </div> </div> </main> <script type="text/javascript" src="<?= BASEFRONT ?>js/jquery/jquery.js"></script> <script type="text/javascript" src="<?= BASEFRONT ?>js/jquery/jquery-ui.js"></script> <script type="text/javascript" src="<?= BASEFRONT ?>js/scroll/scroll.js"></script> <script type="text/javascript" src="<?= BASEFRONT ?>js/tinymce/tinymce.min.js"></script> <script type="text/javascript" src="<?= BASEADMIN ?>js/app.js"></script> <script type="text/javascript"> tinymce.init({ selector: ".wysiwyg", entity_encoding : "raw", encoding: "UTF-8", browser_spellcheck : true, plugins: "link, paste, code ", height:"250px", menubar : false, paste_as_text: true, language : 'fr_FR', content_css : '<?= BASEFRONT ?>js/tinymce/tinymce.css', toolbar: "undo redo | bold italic underline | code" }); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings