2009-11-01 11:00:00 +00:00
|
|
|
<?php
|
2020-11-21 18:54:32 +00:00
|
|
|
if (!defined('INDEX')) {
|
|
|
|
header('Location: ../');
|
|
|
|
exit;
|
|
|
|
}
|
2009-11-01 11:00:00 +00:00
|
|
|
$pagea = 'bandeau';
|
|
|
|
$titre = 'Bandeau d\'information';
|
|
|
|
|
|
|
|
//Ajout d'une information
|
2020-11-21 18:54:32 +00:00
|
|
|
if (!empty($_GET['i']) && $_GET['i'] == 'add' && !empty($_POST['texte']) && isset($_POST['color'])) {
|
|
|
|
$texte = gpc('texte', 'post');
|
|
|
|
$color = gpc('color', 'post');
|
|
|
|
$bdd = new BDD();
|
|
|
|
$bdd->escape($texte);
|
|
|
|
$bdd->escape($color);
|
|
|
|
$bdd->query("INSERT INTO $table_infoshead (texte, color) VALUES ('$texte', '$color');");
|
|
|
|
$bdd->deconnexion();
|
2009-11-01 11:00:00 +00:00
|
|
|
|
2020-11-21 18:54:32 +00:00
|
|
|
header('Location: admin.php?p=bandeau');
|
|
|
|
exit;
|
|
|
|
}
|
2009-11-01 11:00:00 +00:00
|
|
|
//Modification
|
2020-11-21 18:54:32 +00:00
|
|
|
elseif (!empty($_GET['i'])) {
|
|
|
|
$id = intval(gpc('i'));
|
|
|
|
if (!empty($_POST['texte']) && isset($_POST['color'])) {
|
|
|
|
$texte = gpc('texte', 'post');
|
|
|
|
$color = gpc('color', 'post');
|
|
|
|
$bdd = new BDD();
|
|
|
|
$bdd->escape($texte);
|
|
|
|
$bdd->escape($color);
|
|
|
|
$bdd->query("UPDATE $table_infoshead SET texte = '$texte', color = '$color' WHERE id = '$id';");
|
|
|
|
$bdd->deconnexion();
|
|
|
|
|
|
|
|
header('Location: admin.php?p=bandeau');
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$bdd = new BDD();
|
|
|
|
$req = $bdd->unique_query("SELECT * FROM $table_infoshead WHERE id = '$id';");
|
|
|
|
$reqTT = $bdd->query("SELECT * FROM $table_infoshead ORDER BY id ASC;");
|
|
|
|
$bdd->deconnexion();
|
|
|
|
$template->assign('mod', $req);
|
|
|
|
$template->assign('tableau', $reqTT);
|
|
|
|
$template->assign('id', $id);
|
|
|
|
}
|
2009-11-01 11:00:00 +00:00
|
|
|
//Demande de suppression
|
2020-11-21 18:54:32 +00:00
|
|
|
elseif (!empty($_GET['d'])) {
|
|
|
|
$id = intval(gpc('d'));
|
|
|
|
$bdd = new BDD();
|
|
|
|
$bdd->query("DELETE FROM $table_infoshead WHERE id = $id;");
|
|
|
|
$bdd->deconnexion();
|
|
|
|
|
|
|
|
header('Location: admin.php?p=bandeau');
|
|
|
|
exit;
|
|
|
|
}
|
2009-11-01 11:00:00 +00:00
|
|
|
//Demande de mise à jour du cache
|
2020-11-21 18:54:32 +00:00
|
|
|
elseif (isset($_GET['actuCache'])) {
|
|
|
|
Cache::del('headerNB');
|
|
|
|
|
|
|
|
header('Location: admin.php?p=bandeau');
|
|
|
|
exit;
|
|
|
|
} else {
|
|
|
|
//Récupération des lignes du bandeau
|
|
|
|
$bdd = new BDD();
|
|
|
|
$req = $bdd->query("SELECT * FROM $table_infoshead ORDER BY id ASC;");
|
|
|
|
$bdd->deconnexion();
|
2009-11-01 11:00:00 +00:00
|
|
|
|
2020-11-21 18:54:32 +00:00
|
|
|
$template->assign('tableau', $req);
|
|
|
|
$template->assign('id', "add");
|
|
|
|
}
|