diff options
| author | Christophe Nowicki <cnowicki@easter-eggs.com> | 2004-09-16 15:57:55 +0000 |
|---|---|---|
| committer | Christophe Nowicki <cnowicki@easter-eggs.com> | 2004-09-16 15:57:55 +0000 |
| commit | 40940b95aaefd87f9af96439669cc6cb184d69ef (patch) | |
| tree | f0d65eaa1369aeaca88f5774f2ca2cba4932ca27 /php/Attic/examples/sample-idp/log_view.php | |
| parent | 7ea2275ca076a880c27448cdbdfe09ffa9f15db8 (diff) | |
| download | lasso-40940b95aaefd87f9af96439669cc6cb184d69ef.tar.gz lasso-40940b95aaefd87f9af96439669cc6cb184d69ef.tar.xz lasso-40940b95aaefd87f9af96439669cc6cb184d69ef.zip | |
New logging system with a web interface.
Diffstat (limited to 'php/Attic/examples/sample-idp/log_view.php')
| -rw-r--r-- | php/Attic/examples/sample-idp/log_view.php | 108 |
1 files changed, 108 insertions, 0 deletions
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 @@ +<?php +/* + * Identity Provider Example -- View log + * + * Copyright (C) 2004 Entr'ouvert + * http://lasso.entrouvert.org + * + * Authors: Christophe Nowicki <cnowicki@easter-eggs.com> + * + * 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()); + + +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" +"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html> +<head> +<head> + <title>View Logs</title> +</head> +<body> +<br> +<table border='1' width='100%'> +<caption>Logged events</caption> +<thead> +<tr> + <td align='center'>date</td> + <td align='center'>filename</td> + <td align='center'>priority</td> + <td align='center'>message</td> +</tr> +</thead> +<tbody> +<?php + $num_col = $res->numCols(); + $tableinfo = $db->tableInfo($res); + + $desc = array("emergency", "alert", "critical", "error", "warning", "notice", "informational", "debug"); + + while($row = $res->fetchRow()) + { + echo "<tr>"; + for ($i = 0; $i < $num_col; $i++) + { + switch ($tableinfo[$i]['name']) + { + case "id": + break; + case "priority": + echo "<td align='center'>" . $desc[$row[$i]] . "</td>"; + break; + default: + echo "<td align='center'>" . $row[$i] . "</td>"; + } + } + echo "</tr>"; + } +?> +<tr> +</tr> +</tbody> +<tfoot> +<td colspan='5'> </td> +</tfoot> +</table> +<br> +<p>Copyright © 2004 Entr'ouvert</p> +</body> +</html> + |
