Location: PHPKode > projects > DeadZone (Ajax BNT) > bnt2dz.php
<?php
global $dbtables;
global $db;

if (!function_exists('PrintFlush'))
{
	function PrintFlush($Text="")
	{
		print "$Text";
		flush();
	}
}

if (!function_exists('Table_Header'))
{
	function Table_Header($title="")
	{
		PrintFlush( "<div align=\"center\">\n");
		PrintFlush( "  <center>\n");
		PrintFlush( "  <table border=\"0\" cellpadding=\"1\" width=\"700\" cellspacing=\"1\" bgcolor=\"#000000\">\n");
		PrintFlush( "    <tr>\n");
		PrintFlush( "      <th width=\"700\" colspan=\"2\" height=\"20\" bgcolor=\"#9999CC\" align=\"left\"><font face=\"Verdana\" color=\"#000000\" size=\"2\">$title</font></th>\n");
		PrintFlush( "    </tr>\n");
	}
}

if (!function_exists('Table_Row'))
{
	function Table_Row($data,$failed="Failed",$passed="Passed")
	{
		$err = TRUEFALSE(0,mysql_errno(),"No errors found",mysql_errno() . ": " . mysql_error());
		PrintFlush( "    <tr title=\"$err\">\n");
		PrintFlush( "      <td width=\"600\" bgcolor=\"#CCCCFF\"><font face=\"Verdana\" size=\"1\" color=\"#000000\">$data</font></td>\n");
		if(mysql_errno()!=0)
			{
				PrintFlush( "      <td width=\"100\" align=\"center\" bgcolor=\"#C0C0C0\"><font face=\"Verdana\" size=\"1\" color=\"red\">$failed</font></td>\n");
			}
		else
			{
				PrintFlush( "      <td width=\"100\" align=\"center\" bgcolor=\"#C0C0C0\"><font face=\"Verdana\" size=\"1\" color=\"Blue\">$passed</font></td>\n");
			}
		echo "    </tr>\n";
	}
}

function DBTRUEFALSE($truefalse,$Stat,$True,$False)
	{
		return(($truefalse == $Stat) ? $True : $False);
	}

Table_Header("Creating Table");

$db->Execute("CREATE TABLE $dbtables[user_info](" .
             "user_id INT UNSIGNED NOT NULL auto_increment," .
             "email CHAR(60) NOT NULL," .
             "theme TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'," .
             "background TINYINT(1) UNSIGNED NOT NULL DEFAULT '0'," .
             "team_letter enum('a','b','c','d','e') NOT NULL DEFAULT 'd'," .
             "kills INT UNSIGNED NOT NULL DEFAULT '0'," .
             "captures INT UNSIGNED NOT NULL DEFAULT '0'," .
             "owned INT UNSIGNED NOT NULL DEFAULT '0'," .
			 "PRIMARY KEY (user_id)" .
             ")type=innodb");
$err = DBTRUEFALSE(0,mysql_errno(),"No errors found",mysql_errno() . ": " . mysql_error());

Table_Row("Creating user_info Table","Failed","Passed");

// table now exists, we now need to fill the values as defaults using the ship table as its id values and emails

$res = $db->Execute("SELECT * FROM $dbtables[ships] where 1 ORDER BY ship_id ASC");
// we now have the ships table in array $res now we need to read each row and take the email then fill the user_info table with default values
while(!$res->EOF)
	{
		$row = $res->fields;
		$db->Execute("INSERT INTO $dbtables[user_info] VALUES(NULL,'$row[email]',2,2,'d',0,0,0);
	}
echo "User Info Table is updated BNT is Now DeadZone. <br>If you decide to resort back to BNT Run dz2bnt.php to drop the user_info table.<br>";
?>
Return current item: DeadZone (Ajax BNT)