ob_implicit_flush(1); echo "<script>parent.document.getElementById('install_status').style.display='';</script>\r\n"; ob_flush(); flush(); usleep(1000000); $sql_file = dirname(__FILE__) . "/data/install.sql"; $sqls = $dbsql->parseSql($sql_file); mysql_query("CREATE DATABASE IF NOT EXISTS `{$db_name}` DEFAULT CHARACTER SET utf8;"); mysql_query("set names 'utf8'"); mysql_select_db($db_name); $validcode = rundStr(); $key = md5($validcode); $password = md5(substr($key, 0, 16) . $admin_pwd . substr($key, 16, 16)); $insert_admin = "insert into `manager`(`name`,`roles`,`password`,`validcode`,`is_lock`) values ('{$admin_user}','administrator','{$password}','{$validcode}',0)"; $sqls[] = $insert_admin; if ($dbsql->installSql($sqls, $db_pre)) { //配制文件 $config_ini_file = dirname(__FILE__) . "/../protected/config/config.ini.php"; $config_file = dirname(__FILE__) . "/../protected/config/config.php"; $config = (include "{$config_ini_file}"); $config['db'] = array('type' => 'mysql', 'tablePre' => $db_pre, 'host' => $db['host'], 'user' => $db['user'], 'password' => $db['password'], 'name' => $db_name); $str = var_export($config, true); file_put_contents($config_file, '<?php return ' . $str . ';?>'); //重写首页 $index_file = APP_ROOT . './index.php'; $content = '<?php //应用目录,为了程序的更好应用与开发。 define("APP_ROOT",dirname(__file__).DIRECTORY_SEPARATOR); //引入框架文件 include("framework/tiny.php");