Location: PHPKode > projects > DeadZone (Ajax BNT) > test_db.php
<?
	include("config.php");
	updatecookie();

	include("languages/$lang");
	$title="Blank Page Fault Finder";
	include("header.php");

	$lastupdate = date("l, F d, Y",filemtime (basename ($_SERVER['PHP_SELF'])));
	$version = "0.2.0 (Beta)";
	$author = "Paul Kirby AKA TheMightyDude";
	$email = "hide@address.com";

	if (function_exists('md5_file')) $hash = strtoupper(md5_file(basename ($_SERVER['PHP_SELF'])));

	$MAX_TESTS = 5;

	bigtitle();

/* connect to database - and if we can't stop right there */
	global $connectedtodb;
	if ($connectedtodb) { return; } else { $connectedtodb = true; }
	global $dbhost, $dbport, $dbuname, $dbpass, $dbname;
	global $default_lang, $lang, $gameroot, $db_type;
	global $db_persistent, $db, $ADODB_FETCH_MODE;

Function PrintFlush($Text="") 
{
	print "$Text";
	flush();
}

Function CreateTableHeader()
{
	PrintFlush ("<div align=\"center\">\n");
	PrintFlush ("<table border=\"0\" cellspacing=\"1\" width=\"600\" bgcolor=\"#000000\">\n");
	PrintFlush ("  <tr>\n");
	PrintFlush ("    <th width=\"100\" bgcolor=\"#9999CC\"><font size=\"2\" color=\"#000000\">Test NO</font></th>\n");
	PrintFlush ("    <th width=\"400\" align=\"left\" bgcolor=\"#9999CC\"><font size=\"2\" color=\"#000000\">Section under test...</font></th>\n");
	PrintFlush ("    <th width=\"100\" bgcolor=\"#9999CC\"><font size=\"2\" color=\"#000000\">Result</font></th>\n");
	PrintFlush ("  </tr>\n");
}

Function CreateTableRow($TestNO,$TestInfo,$TestResult)
{
	PrintFlush ("  <tr>\n");
	PrintFlush ("    <td width=\"100\" align=\"center\" bgcolor=\"#CCCCFF\"><font size=\"2\" color=\"#FF0000\">$TestNO</font></td>\n");
	PrintFlush ("    <td width=\"400\" bgcolor=\"#C0C0C0\"><font size=\"2\">Testing: [<font color=\"#000000\">$TestInfo</font>]</font></td>\n");
	PrintFlush ("    <td width=\"100\" align=\"center\" bgcolor=\"#CCCCFF\"><font size=\"2\" color=\"#0000FF\"><B>$TestResult</B></font></td>\n");
	PrintFlush ("  </tr>\n");
}

Function CreateTableFooter()
{
	PrintFlush ("  <tr>\n");
	PrintFlush ("    <td width=\"600\" align=\"left\" bgcolor=\"#9999CC\" colspan=\"3\"><font size=\"2\" color=\"#000000\">Test Complete</font></td>\n");
	PrintFlush ("  </tr>\n");
	PrintFlush ("</table>\n");
	PrintFlush ("</center></div>\n");
	PrintFlush ("<br>\n");
}

	PrintFlush ("<p align=\"Left\"><big><strong>This script is intended for people that are getting Blank pages on create_universe.php.</strong></big></p>\n");
	PrintFlush ("<p align=\"Left\"><big><strong>If this page dont complete all $MAX_TESTS of the tests then do either of the following:</strong></big></p>\n");
	PrintFlush ("<p align=\"Left\"><big><strong>1: Email me at <a href=\"mailto:hide@address.com\" class=\"nav\">TheMightyDude</a></strong></big><BR>\n");
	PrintFlush ("<strong><big>2: Post it in the Forums under section <a href=\"http://www.blacknova.net/viewforum.php?f=8\" class=\"nav\" target=\"_blank\">Troubleshooting</a>.</big></strong></p>\n");

	CreateTableHeader();

	$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;

	CreateTableRow("Test 1 of $MAX_TESTS","ADODB_FETCH_MODE = ADODB_FETCH_ASSOC","Passed");

	if(!empty($dbport)) 
	{
		$dbhost.= ":$dbport";
	}

	CreateTableRow("Test 2 of $MAX_TESTS","Setting up Host an Port","Passed");

	$db = ADONewConnection("$db_type");

	CreateTableRow("Test 3 of $MAX_TESTS","Create db as ADONewConnection","Passed");
	
	if($db_persistent == 1)
	{
		$result = $db->PConnect("$dbhost", "$dbuname", "$dbpass", "$dbname");
		CreateTableRow("Test 4 of $MAX_TESTS","Checking Connection to using PConnect","Passed");
	}
	else
	{
		$result = $db->Connect("$dbhost", "$dbuname", "$dbpass", "$dbname");
		CreateTableRow("Test 4 of $MAX_TESTS","Checking Connection to using Connect","Passed");
	}

	if(!$result) die ("Unable to connect to the database");

	CreateTableRow("Test 5 of $MAX_TESTS","Checking the Die if failed","Passed");
	CreateTableFooter();

	PrintFlush ("<br><br>Well I got to the End<br>\n");
	PrintFlush ("<font color=\"#00FF00\">So all Passed</font><br>\n");

	PrintFlush ("<p align=\"Left\"><strong>This is <u>NOT</u> a fix but just to see if the error is in the connectdb function in global_funcs.php.</strong><BR>\n");
	PrintFlush ("<strong>And if so this should show where the error is.</strong></p>\n");

	#########################################
	#         My Script Information.        #
	#########################################

	PrintFlush("<hr size=\"1\">\n");
	PrintFlush("<div align=\"center\">\n");
	PrintFlush("  <center>\n");
	PrintFlush("  <table border=\"0\" cellspacing=\"0\" width=\"100%\">\n");
	PrintFlush("    <tr>\n");
	PrintFlush("      <td width=\"50%\" nowrap valign=\"top\" align=\"left\"><font face=\"Verdana\" size=\"1\">Last updated on <font color=\"lime\">$lastupdate</font></font></td>\n");
	PrintFlush("      <td width=\"50%\" nowrap valign=\"top\" align=\"right\"><font face=\"Verdana\" size=\"1\">Written by <font color=\"lime\">$author</font></font></td>\n");
	PrintFlush("    </tr>\n");
	PrintFlush("    <tr>\n");
	PrintFlush("      <td width=\"50%\" nowrap valign=\"top\" align=\"left\"><font face=\"Verdana\" size=\"1\">Version <font color=\"lime\">$version</font>");

	if (function_exists('md5_file')) PrintFlush(" Hash: [<font color=\"yellow\">$hash</font>]");
	else PrintFlush(" Hash: [<font color=\"yellow\">Disabled</font>]");

	PrintFlush("</font></td>\n");
	PrintFlush("      <td width=\"50%\" nowrap valign=\"top\" align=\"right\"><font face=\"Verdana\" size=\"1\">Email <font color=\"lime\"><a class=\"email\" href=\"mailto:$email\">$email</a></font></font></td>\n");
	PrintFlush("    </tr>\n");
	PrintFlush("  </table>\n");
	PrintFlush("  </center>\n");
	PrintFlush("</div>\n");
	PrintFlush("<hr size=\"1\">\n");

	include("footer.php");

?>
Return current item: DeadZone (Ajax BNT)