HB/game/bugs.php

28 lines
1.1 KiB
PHP

<?php
if(!defined('INDEX')) { header('Location: ../'); exit; }
$page = 'bugs';
$titre = 'Rapports de bugs';
if (!empty($_POST['page']) && !empty($_POST['description'])) {
$pages = $_POST['page'];
$chapeau->escape($pages);
$description = $_POST['description'];
$chapeau->escape($description);
$chapeau->query("INSERT INTO `$table_bug` VALUES(NULL, '".$queryUser['pseudo']."', '".time()."', '$pages', '$description');");
header('Location: ?p=bugs');
}
elseif (isset($_GET['a']) && $_GET['a'] == 'del' && isset($_GET['i']) && $sess->values['auth_level'] > 2) {
$i = $_GET['i'];
$chapeau->escape($i);
$chapeau->query("DELETE FROM `$table_bug` WHERE `id` = '$i' LIMIT 1");
header('Location: ?p=bugs');
}
$bugs = $chapeau->query("SELECT * FROM `$table_bug` ORDER BY `id` DESC");
$TEMP_bugs = array();
for ($i = 0; $i < $chapeau->num_rows; $i++) {
$TEMP_bugs[] = array('<a href="?p=envoyer&d='.$bugs[$i]['pseudo'].'">'.$bugs[$i]['pseudo'].'</a>', date("d/m/y h:m:s", $bugs[$i]['temps']), $bugs[$i]['page'], nl2br(htmlspecialchars(str_replace('\\\'', '\'', $bugs[$i]['description']))), $bugs[$i]['id']);
}
$template->assign('bugs', $TEMP_bugs);
?>