diff options
| author | Christophe Nowicki <cnowicki@easter-eggs.com> | 2004-09-17 16:02:24 +0000 |
|---|---|---|
| committer | Christophe Nowicki <cnowicki@easter-eggs.com> | 2004-09-17 16:02:24 +0000 |
| commit | 1db82e571dd29835ee669472de1a646314e12aa9 (patch) | |
| tree | a5327193d410a974e21dc27e6554420c5bec8a1b /php/Attic/examples/sample-idp/log_view.php | |
| parent | cc5bffb4bd9a1f3f057be78bfcd71db51a74dfc8 (diff) | |
| download | lasso-1db82e571dd29835ee669472de1a646314e12aa9.tar.gz lasso-1db82e571dd29835ee669472de1a646314e12aa9.tar.xz lasso-1db82e571dd29835ee669472de1a646314e12aa9.zip | |
log viewer for the Service Provider and the Identity Provider
added logger for in many files
updated idp1 metadata, added .php extension
added session viewer for the sp (you will be able to view online users)
Diffstat (limited to 'php/Attic/examples/sample-idp/log_view.php')
| -rw-r--r-- | php/Attic/examples/sample-idp/log_view.php | 96 |
1 files changed, 74 insertions, 22 deletions
diff --git a/php/Attic/examples/sample-idp/log_view.php b/php/Attic/examples/sample-idp/log_view.php index fb68fbdc..68acc458 100644 --- a/php/Attic/examples/sample-idp/log_view.php +++ b/php/Attic/examples/sample-idp/log_view.php @@ -37,16 +37,27 @@ $number_of_msg = 8; + // Count log messages + $query = "SELECT COUNT(*) FROM log"; + $res =& $db->query($query); + if (DB::isError($res)) + die($res->getMessage()); + + $row = $res->fetchRow(); + $count = $row[0]; + $startMsg = ((empty($_GET['startMsg'])) ? 0 : $_GET['startMsg']); - $query = "SELECT * FROM log"; + $query = "SELECT * FROM log ORDER BY id DESC"; if (!isset($_GET['show_all'])) $query .= " OFFSET $startMsg LIMIT " . ($startMsg + $number_of_msg); - + + $res =& $db->query($query); - if (DB::isError($db)) - die($db->getMessage()); + if (DB::isError($res)) + die($res->getMessage()); + $numRows = $res->numRows(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" @@ -54,7 +65,7 @@ <html> <head> <head> - <title>View Logs</title> + <title>Lasso Identity Provider Example : View Logs</title> </head> <body> <br> @@ -62,6 +73,36 @@ <caption>Logged events</caption> <thead> <tr> + <td colspan='4'> + <?php + if ($startMsg) + echo "<a href=$PHP_SELF?startMsg=" . ($startMsg - $number_of_msg) . ">Previous</a>"; + else + echo "Previous" + ?> + | + <?php + if ((($count - $startMsg) > $number_of_users) && !isset($_GET['show_all'])) + echo "<a href=\"" . $PHP_SELF . "?startMsg=" . ($startMsg + $number_of_msg) . "\">Next</a>"; + else + echo "Next"; + + if (isset($_GET['show_all'])) + echo "| <a href=\"" . $PHP_SELF ."?startMsg=0\">Paginate</a>"; + else + { + for ($i = 0; $i < $count; $i += $number_of_msg) + if ($i == $startMsg) + echo "| " . ( $i / $number_of_msg); + else + echo "| <a href=\"$PHP_SELF?startMsg=$i\">" . ( $i / $number_of_msg) . "</a>"; + if ($count > $number_of_msg) + echo "| <a href=\"$PHP_SELF?show_all=1\">Show All</a>"; + } + ?> + </td> +</tr> +<tr> <td align='center'>date</td> <td align='center'>filename</td> <td align='center'>priority</td> @@ -70,38 +111,49 @@ </thead> <tbody> <?php - $num_col = $res->numCols(); - $tableinfo = $db->tableInfo($res); + if ($numRows) + { + $num_col = $res->numCols(); + $tableinfo = $db->tableInfo($res); - $desc = array("emergency", "alert", "critical", "error", "warning", "notice", "informational", "debug"); + $desc = array("emergency", "alert", "critical", "error", "warning", "notice", "informational", "debug"); - while($row = $res->fetchRow()) - { - echo "<tr>"; - for ($i = 0; $i < $num_col; $i++) + while($row = $res->fetchRow()) { - switch ($tableinfo[$i]['name']) + echo "<tr>"; + for ($i = 0; $i < $num_col; $i++) { - case "id": - break; - case "priority": - echo "<td align='center'>" . $desc[$row[$i]] . "</td>"; - break; - default: - echo "<td align='center'>" . $row[$i] . "</td>"; + switch ($tableinfo[$i]['name']) + { + case "id": + break; + case "priority": + echo "<td align='center'>" . $desc[$row[$i]] . "</td>"; + break; + case "message": + echo "<td>" . $row[$i] . "</td>"; + break; + default: + echo "<td align='center'>" . $row[$i] . "</td>"; + } } + echo "</tr>"; } - echo "</tr>"; } ?> <tr> </tr> </tbody> <tfoot> -<td colspan='5'> </td> +<tr> + <td colspan='4'> </td> +</tr> </tfoot> </table> <br> +<p align='center'><a href='index.php'>Index</a> +</p> +<br> <p>Copyright © 2004 Entr'ouvert</p> </body> </html> |
