From 40940b95aaefd87f9af96439669cc6cb184d69ef Mon Sep 17 00:00:00 2001 From: Christophe Nowicki Date: Thu, 16 Sep 2004 15:57:55 +0000 Subject: New logging system with a web interface. --- php/Attic/examples/sample-idp/log_view.php | 108 +++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 php/Attic/examples/sample-idp/log_view.php (limited to 'php/Attic/examples/sample-idp/log_view.php') diff --git a/php/Attic/examples/sample-idp/log_view.php b/php/Attic/examples/sample-idp/log_view.php new file mode 100644 index 00000000..fb68fbdc --- /dev/null +++ b/php/Attic/examples/sample-idp/log_view.php @@ -0,0 +1,108 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + require_once 'HTML/QuickForm.php'; + require_once 'DB.php'; + + $config = unserialize(file_get_contents('config.inc')); + + // connect to the data base + $db = &DB::connect($config['dsn']); + if (DB::isError($db)) + die("Could not connect to the database"); + + if ($config['log_handler'] != 'sql') + die("Unsupported log handler"); + + $number_of_msg = 8; + + $startMsg = ((empty($_GET['startMsg'])) ? 0 : $_GET['startMsg']); + + $query = "SELECT * FROM log"; + if (!isset($_GET['show_all'])) + $query .= " OFFSET $startMsg LIMIT " . ($startMsg + $number_of_msg); + + $res =& $db->query($query); + if (DB::isError($db)) + die($db->getMessage()); + + +?> + + + + + View Logs + + +
+ + + + + + + + + + + +numCols(); + $tableinfo = $db->tableInfo($res); + + $desc = array("emergency", "alert", "critical", "error", "warning", "notice", "informational", "debug"); + + while($row = $res->fetchRow()) + { + echo ""; + for ($i = 0; $i < $num_col; $i++) + { + switch ($tableinfo[$i]['name']) + { + case "id": + break; + case "priority": + echo ""; + break; + default: + echo ""; + } + } + echo ""; + } +?> + + + + + + +
Logged events
datefilenameprioritymessage
" . $desc[$row[$i]] . "" . $row[$i] . "
 
+
+

Copyright © 2004 Entr'ouvert

+ + + -- cgit