name); $str .= GetBlock($finfo->table); $type = $finfo->type; $length = $finfo->length; $str .= GetLongBinary($type); $intflag = $finfo->flags; $str .= GetLongBinary($intflag); $str .= GetLongBinary($length); } else { $str .= GetBlock(mysql_field_name($res, $i)); $str .= GetBlock(mysql_field_table($res, $i)); $type = mysql_field_type($res, $i); $length = mysql_field_len($res, $i); switch ($type) { case "int": if( $length > 11 ) $type = 8; else $type = 3; break; case "real": if( $length == 12 ) $type = 4; elseif( $length == 22 ) $type = 5; else $type = 0; break; case "null": $type = 6; break; case "timestamp": $type = 7; break; case "date": $type = 10; break; case "time": $type = 11; break; case "datetime": $type = 12; break; case "year": $type = 13; break; case "blob": if( $length > 16777215 ) $type = 251; elseif( $length > 65535 ) $type = 250; elseif( $length > 255 ) $type = 252; else $type = 249; break; default: $type = 253; } $str .= GetLongBinary($type); $flags = explode( " ", mysql_field_flags ( $res, $i ) ); $intflag = 0; if(in_array( "not_null", $flags )) $intflag += 1; if(in_array( "primary_key", $flags )) $intflag += 2; if(in_array( "unique_key", $flags )) $intflag += 4; if(in_array( "multiple_key", $flags )) $intflag += 8; if(in_array( "blob", $flags )) $intflag += 16; if(in_array( "unsigned", $flags )) $intflag += 32; if(in_array( "zerofill", $flags )) $intflag += 64; if(in_array( "binary", $flags)) $intflag += 128; if(in_array( "enum", $flags )) $intflag += 256; if(in_array( "auto_increment", $flags )) $intflag += 512; if(in_array( "timestamp", $flags )) $intflag += 1024; if(in_array( "set", $flags )) $intflag += 2048; $str .= GetLongBinary($intflag); $str .= GetLongBinary($length); } } echo $str; } function EchoData($res, $numfields, $numrows) { for( $i = 0; $i < $numrows; $i++ ) { $str = ""; $row = null; if ($GLOBALS['use_mysqli']) $row = mysqli_fetch_row( $res ); else $row = mysql_fetch_row( $res ); for( $j = 0; $j < $numfields; $j++ ){ if( is_null($row[$j]) ) $str .= "\xFF"; else $str .= GetBlock($row[$j]); } echo $str; } } function doSystemTest() { function output($description, $succ, $resStr) { echo "$description$resStr[0]" : "class=\"TestFail\">$resStr[1]"; } output("PHP version >= 4.0.5", phpversion_int() >= 40005, array("Yes", "No")); output("mysql_connect() available", function_exists("mysql_connect"), array("Yes", "No")); output("mysqli_connect() available", function_exists("mysqli_connect"), array("Yes", "No")); if (phpversion_int() >= 40302 && substr($_SERVER["SERVER_SOFTWARE"], 0, 6) == "Apache" && function_exists("apache_get_modules")){ if (in_array("mod_security2", apache_get_modules())) output("Mod Security 2 installed", false, array("No", "Yes")); } } ///////////////////////////////////////////////////////////////////////////// //// if (phpversion_int() < 40005) { EchoHeader(201); echo GetBlock("unsupported php version"); exit(); } if (phpversion_int() < 40010) { global $HTTP_POST_VARS; $_POST = &$HTTP_POST_VARS; } if (!isset($_POST["actn"]) || !isset($_POST["host"]) || !isset($_POST["port"]) || !isset($_POST["login"])) { $testMenu = $allowTestMenu; if (!$testMenu){ EchoHeader(202); echo GetBlock("invalid parameters"); exit(); } } if (!$testMenu){ if ($_POST["encodeBase64"] == '1') { for($i=0;$i 0) { EchoHeader($errno_c); echo GetBlock(mysqli_connect_error($conn)); exit; } if(($errno_c <= 0) && ( $_POST["db"] != "" )) { $res = mysqli_select_db($conn, $_POST["db"] ); $errno_c = mysqli_errno($conn); } EchoHeader($errno_c); if($errno_c > 0) { echo GetBlock(mysqli_error($conn)); } elseif($_POST["actn"] == "C") { EchoConnInfo($conn); } elseif($_POST["actn"] == "Q") { for($i=0;$i 0) echo GetBlock(mysqli_error($conn)); else { if($numfields > 0) { EchoFieldsHeader($res, $numfields); EchoData($res, $numfields, $numrows); } else { if(phpversion_int() >= 40300) echo GetBlock(mysqli_info($conn)); else echo GetBlock(""); } } if($i<(count($_POST["q"])-1)) echo "\x01"; else echo "\x00"; if (false !== $res) mysqli_free_result($res); } } } else { if( $_POST["port"] ) $hs .= ":".$_POST["port"]; $conn = mysql_connect($hs, $_POST["login"], $_POST["password"]); $errno_c = mysql_errno(); //if (phpversion_int() >= 50203){ // for unicode database name // mysql_set_charset('UTF8'); //} if(($errno_c <= 0) && ( $_POST["db"] != "" )) { $res = mysql_select_db( $_POST["db"], $conn); $errno_c = mysql_errno(); } EchoHeader($errno_c); if($errno_c > 0) { echo GetBlock(mysql_error()); } elseif($_POST["actn"] == "C") { EchoConnInfo($conn); } elseif($_POST["actn"] == "Q") { for($i=0;$i 0) echo GetBlock(mysql_error()); else { if($numfields > 0) { EchoFieldsHeader($res, $numfields); EchoData($res, $numfields, $numrows); } else { if(phpversion_int() >= 40300) echo GetBlock(mysql_info($conn)); else echo GetBlock(""); } } if($i<(count($_POST["q"])-1)) echo "\x01"; else echo "\x00"; mysql_free_result($res); } } } exit(); } header("Content-Type: text/html"); //// ///////////////////////////////////////////////////////////////////////////// ?> Navicat HTTP Tunnel Tester

Navicat™
The gateway to your database!

System Environment Test ">
PHP installed properlyNo

Server Test
Hostname/IP Address:
Port:
Initial Database:
Username:
Password:
Database File: