<?php
// *
// * DebugTest.php - STests to make sure
// * the phpDebugger can clear, read & write
// * to the debug table.
// *
// * Run this to see if everthing is properly
// * configured.
// *
// * 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
// *
include "../sqlinc.php";
include "debuginc.php";
?>
<html>
<head>
</head>
<body>
<h1>Debug module loaded</h1>
<?php
// test table delete
echo "<h1>Attempting debug table truncate (delete)</h1>";
$query = "TRUNCATE TABLE debug";
$result = mysql_query($query) or die(mysql_error());
if($result == false)
{
echo "<h1><font color='red'>Unable to truncate debug table!!!</font></h1>";
}
echo "<h1>Debug table truncated!</h1>";
// teset table write
echo "<h1>Attempting debug table write/read (insert)!</h1>";
OutputDebugString('This is a test record');
// query the database
$query = "SELECT * FROM debug ORDER BY date_time";
$result = mysql_query($query) or die(mysql_error());
if($result)
{
while($row = mysql_fetch_assoc($result))
{
extract($row);
if($string == 'This is a test record')
{
echo "<h1>Table write/read successful</h1>";
}
}
}
else
{
echo "<h1><font color='red'>Unable to insert record into debug table!!!</font></h1>";
exit;
}
// clean up after ourselves
echo "<h1>Attempting debug test clean-up</h1>";
$query = "TRUNCATE TABLE debug";
$result = mysql_query($query) or die(mysql_error());
if($result == false)
{
echo "<h1><font color='red'>Unable to clean-up after teset, debug table NOT cleared!!!</font></h1>";
exit;
}
else
{
echo "<h1>Debug table truncated!</h1>";
echo "<h1>Debug test successful!</h1>";
}
?>
</body>
</html>