$dbpassword = trim($_POST['dbpassword']); $dbname = trim($_POST['dbname']); $table_prefix = trim($_POST['table_prefix']); if ($dbhost == "" or $dbuser == "" or $dbpassword == "" or $dbname == "" or $table_prefix == "") { $msg .= "<SPAN class=err>{$strIsNull}</span><br />"; $nextAccess = 0; } if (strstr($table_prefix, '.') and $nextAccess == 1) { $msg .= "<SPAN class=err>{$strPrefixErr}</span><br />"; $nextAccess = 0; } if ($nextAccess == 1) { include '../include/db.php'; // 连结数据库 $DM = new DummyMySQLClass($dbhost, $dbuser, $dbpassword, $dbname, false); if ($DM->error()) { $msg .= "<SPAN class=err>{$strNoConnDB}</span><br />"; $nextAccess = 0; } } if ($nextAccess == 1) { $mysqlversion = $DM->fetchArray($DM->query("SELECT VERSION() AS version")); $curr_mysql_version = $mysqlversion['version']; if ($curr_mysql_version < '4.0') { $msg .= "<SPAN class=err>{$strMixMysql}</span><br />"; $nextAccess = 0; } } if ($nextAccess == 1) { if ($curr_mysql_version > '4.1') { $DM->query("ALTER DATABASE `{$dbname}` DEFAULT CHARACTER SET {$dbcharset} ");
$TableEncode = $fo->Collation; $TotalRecord += $DataRecord; $DBEncode = $TableEncode; $TotalSize += $DataSize; $TotalSurplus = $Surplus; } // …… } // drop table if exists $md5 = md5('admin'); $sql_Drop = "DROP TABLE IF EXISTS dmc_demo;"; $DropResult = $DMC->query($sql_Drop); if (false === $DropResult) { echo '删除表失败。<BR>'; echo $DMC->errno() . " : "; echo $DMC->error(); die; } // create a test table $sql_Create = "CREATE TABLE dmc_demo(\r\n\t id int(9) not null auto_increment,\r\n\t name varchar(32) not null default '',\r\n\t pswd varchar(32) not null default '',\r\n\t sex enum('1', '0', '-1') not null default '0',\r\n\t age smallint(3) not null default 0,\r\n\t primary key (id)\r\n\t);"; $CreateResult = $DMC->query($sql_Create); if (false === $CreateResult) { echo '建表失败。<BR>'; echo $DMC->errno() . " : "; echo $DMC->error(); die; } // insert one line $sql_Insert = "insert into dmc_demo values('', 'Dummy', '" . $md5 . "', '1', '11');"; $InsertResult = $DMC->query($sql_Insert); if (false === $InsertResult || !$DMC->affectedRows()) {