HB/onyx/hb_game/jeu/admin/bandeau.php

60 lines
1.6 KiB
PHP
Raw Normal View History

2008-11-04 11:00:00 +00:00
<?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'];
2008-11-16 11:00:00 +00:00
$chapeau->connexion();
$chapeau->escape($texte);
2008-11-04 11:00:00 +00:00
$chapeau->escape($color);
2008-11-16 11:00:00 +00:00
$chapeau->query("INSERT INTO $table_infoshead VALUES (NULL, '$texte', '$color');");
$chapeau->deconnexion();
2008-11-04 11:00:00 +00:00
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'];
2008-11-16 11:00:00 +00:00
$chapeau->connexion();
$chapeau->escape($texte);
2008-11-04 11:00:00 +00:00
$chapeau->escape($color);
2008-11-16 11:00:00 +00:00
$chapeau->query("UPDATE $table_infoshead SET texte = '$texte', color = '$color' WHERE id = '$id';");
$chapeau->deconnexion();
2008-11-04 11:00:00 +00:00
header('Location: admin.php?p=bandeau');
exit;
}
2008-11-16 11:00:00 +00:00
$chapeau->connexion();
$req = $chapeau->unique_query("SELECT * FROM $table_infoshead WHERE id = '$id';");
$chapeau->deconnexion();
2008-11-04 11:00:00 +00:00
$template->assign('mod', $req);
$template->assign('id', $id);
$pagea = 'bandeau_add';
}
elseif (!empty($_GET['d'])) {
$id = $_GET['d'];
2008-11-16 11:00:00 +00:00
$chapeau->connexion();
$chapeau->query("DELETE FROM $table_infoshead WHERE id = '$id';");
$chapeau->deconnexion();
2008-11-04 11:00:00 +00:00
header('Location: admin.php?p=bandeau');
exit;
}
else {
2008-11-16 11:00:00 +00:00
$chapeau->connexion();
$req = $chapeau->query("SELECT * FROM $table_infoshead;");
$chapeau->deconnexion();
2008-11-04 11:00:00 +00:00
$template->assign('tableau', $req);
}
?>