game/onyx/hb_game/jeu/bugs.php

38 lines
1.3 KiB
PHP
Raw Normal View History

2008-11-17 11:00:00 +00:00
<?php
if(!defined('INDEX')) { header('Location: ../'); exit; }
$page = 'bugs';
$titre = 'Rapports de bugs';
if (!empty($_POST['page']) && !empty($_POST['description'])) {
2008-11-22 11:00:00 +00:00
$pages = $_POST['page'];
$description = $_POST['description'];
2008-11-16 11:00:00 +00:00
$pseudo = $queryUser['pseudo'];
$time = time();
2008-11-22 11:00:00 +00:00
2008-11-04 11:00:00 +00:00
$bdd->connexion();
$bdd->escape($pages);
$bdd->escape($description);
2008-11-16 11:00:00 +00:00
$bdd->query("INSERT INTO $table_bug VALUES(NULL, '$pseudo', '$time', '$pages', '$description');");
2008-11-04 11:00:00 +00:00
$bdd->deconnexion();
2008-11-17 11:00:00 +00:00
header('Location: ?p=bugs');
2008-11-04 11:00:00 +00:00
exit;
2008-11-17 11:00:00 +00:00
}
elseif (isset($_GET['a']) && $_GET['a'] == 'del' && isset($_GET['i']) && $sess->values['auth_level'] > 2) {
2008-11-22 11:00:00 +00:00
$i = $_GET['i'];
2008-11-04 11:00:00 +00:00
$bdd->connexion();
$bdd->escape($i);
2008-11-16 11:00:00 +00:00
$bdd->query("DELETE FROM $table_bug WHERE id = '$i' LIMIT 1;");
2008-11-04 11:00:00 +00:00
$bdd->deconnexion();
2008-11-17 11:00:00 +00:00
header('Location: ?p=bugs');
2008-11-04 11:00:00 +00:00
exit;
2008-11-17 11:00:00 +00:00
}
2008-11-04 11:00:00 +00:00
$bdd->connexion();
2008-11-16 11:00:00 +00:00
$bugs = $bdd->query("SELECT id, pseudo, temps, page, description FROM $table_bug ORDER BY id DESC");
2008-11-04 11:00:00 +00:00
$bdd->deconnexion();
2008-11-17 11:00:00 +00:00
$TEMP_bugs = array();
2008-11-04 11:00:00 +00:00
for ($i = 0; $i < $bdd->num_rows; $i++) {
2008-11-22 11:00:00 +00:00
$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']);
2008-11-17 11:00:00 +00:00
}
$template->assign('bugs', $TEMP_bugs);
?>