60 lines
1.6 KiB
PHP
60 lines
1.6 KiB
PHP
<?php
|
|
if(!defined('INDEX')) { header('Location: ../'); exit; }
|
|
$pagea = 'bandeau';
|
|
$titre = 'Bandeau d\'information';
|
|
|
|
$template->assign('linkpage', 'bandeau');
|
|
|
|
if (!empty($_GET['i']) && $_GET['i'] == 'add') {
|
|
if (!empty($_POST['texte']) && isset($_POST['color'])) {
|
|
$texte = $_POST['texte'];
|
|
$color = $_POST['color'];
|
|
$chapeau->connexion();
|
|
$chapeau->escape($texte);
|
|
$chapeau->escape($color);
|
|
$chapeau->query("INSERT INTO $table_infoshead (texte, color) VALUES ('$texte', '$color');");
|
|
$chapeau->deconnexion();
|
|
|
|
header('Location: admin.php?p=bandeau');
|
|
exit;
|
|
}
|
|
$template->assign('id', 'add');
|
|
$pagea = 'bandeau_add';
|
|
}
|
|
elseif (!empty($_GET['i'])) {
|
|
$id = $_GET['i'];
|
|
if (!empty($_POST['texte']) && isset($_POST['color'])) {
|
|
$texte = $_POST['texte'];
|
|
$color = $_POST['color'];
|
|
$chapeau->connexion();
|
|
$chapeau->escape($texte);
|
|
$chapeau->escape($color);
|
|
$chapeau->query("UPDATE $table_infoshead SET texte = '$texte', color = '$color' WHERE id = '$id';");
|
|
$chapeau->deconnexion();
|
|
|
|
header('Location: admin.php?p=bandeau');
|
|
exit;
|
|
}
|
|
$chapeau->connexion();
|
|
$req = $chapeau->unique_query("SELECT * FROM $table_infoshead WHERE id = '$id';");
|
|
$chapeau->deconnexion();
|
|
$template->assign('mod', $req);
|
|
$template->assign('id', $id);
|
|
$pagea = 'bandeau_add';
|
|
}
|
|
elseif (!empty($_GET['d'])) {
|
|
$id = $_GET['d'];
|
|
$chapeau->connexion();
|
|
$chapeau->query("DELETE FROM $table_infoshead WHERE id = '$id';");
|
|
$chapeau->deconnexion();
|
|
|
|
header('Location: admin.php?p=bandeau');
|
|
exit;
|
|
}
|
|
else {
|
|
$chapeau->connexion();
|
|
$req = $chapeau->query("SELECT * FROM $table_infoshead;");
|
|
$chapeau->deconnexion();
|
|
$template->assign('tableau', $req);
|
|
}
|
|
?>
|