50 lines
1.4 KiB
PHP
50 lines
1.4 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'];
|
||
|
$chapeau->escape($texte);
|
||
|
$color = $_POST['color'];
|
||
|
$chapeau->escape($color);
|
||
|
$chapeau->query("INSERT INTO `infoshead` VALUES (NULL, '$texte', '$color');");
|
||
|
|
||
|
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'];
|
||
|
$chapeau->escape($texte);
|
||
|
$color = $_POST['color'];
|
||
|
$chapeau->escape($color);
|
||
|
$chapeau->query("UPDATE `infoshead` SET `texte` = '$texte', `color` = '$color' WHERE `id` = '$id';");
|
||
|
|
||
|
header('Location: admin.php?p=bandeau');
|
||
|
exit;
|
||
|
}
|
||
|
$req = $chapeau->unique_query("SELECT * FROM `infoshead` WHERE `id` = '$id';");
|
||
|
$template->assign('mod', $req);
|
||
|
$template->assign('id', $id);
|
||
|
$pagea = 'bandeau_add';
|
||
|
}
|
||
|
elseif (!empty($_GET['d'])) {
|
||
|
$id = $_GET['d'];
|
||
|
$chapeau->query("DELETE FROM `infoshead` WHERE `id` = '$id';");
|
||
|
|
||
|
header('Location: admin.php?p=bandeau');
|
||
|
exit;
|
||
|
}
|
||
|
else {
|
||
|
$req = $chapeau->query("SELECT * FROM `infoshead`;");
|
||
|
$template->assign('tableau', $req);
|
||
|
}
|
||
|
?>
|