<?php
// *
// * DebugView.php - Reads the debug table,
// * builds an output table of all entries and
// * then returns to caller. This uses the meta
// * tag "refresh" to force an auto refresh ever
// * 3 seconds or so. Long tables can collied
// * with the 3 sec refresh so be careful!
// *
// * Project was written by Phil Petree
// * and is available at philpetree.com
// * and is released under GNU license.
// * Copyright (C) 2010 by Phill Petree. All rights reserved worldwide.
// * US Governement users have restricted rights.
// *
// * Ver 1.0 - Release date: June 22, 2010
// *
// pull in our sql lib & config data
include "../sqlinc.php";
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="alternate" type="application/rss+xml" title="ROR" href="ror.xml">
<script type = "text/javascript">
function CopyToClip()
{
var div = document.getElementById('DivtoCopy');
div.contentEditable = 'true';
var controlRange;
if (document.body.createControlRange)
{
controlRange = document.body.createControlRange();
controlRange.addElement(div);
controlRange.execCommand('Copy');
}
div.contentEditable = 'false';
}
</script>
</head>
<body font='arial'>
<?php
// query the database
// $query = "SELECT * FROM user_profile WHERE username='" . $_POST['userid'] . "'";
$query = "SELECT * FROM debug ORDER BY date_time";
$result = mysql_query($query) or die(mysql_error());
// only output a table if we have data in the debug table
if( mysql_num_rows($result) )
{
echo "<div id = 'DivtoCopy'>";
echo "<table border='2' width='100%'>";
echo "<tr>";
echo "<th width='10%'>ID</th>";
echo "<th width='20%' align='left'>DATE/TIME</th>";
echo "<th width='30%' align='left'>Module</th>";
echo "<th width='40%' align='left'>Output String</th>";
echo "</tr>";
while($row = mysql_fetch_assoc($result))
{
extract($row);
echo "<tr>";
echo "<td align='center'>$id</td><td>$date_time</td><td>$module</td><td>$string</td>";
echo "</tr>";
}
echo "</table>";
echo "</div>";
echo "<button onclick=\"CopyToClip();\">Copy To Clipboard</button>";
}
else
{
echo "<center><h2>No debug data available</h2></center>";
}
?>
</body>
</html>