header("content-type:text/html;charset=utf8");
$host = isset($_POST['host'])?$_POST['host']:"";
$user = isset($_POST['user'])?$_POST['user']:"";
$password = isset($_POST['password'])?$_POST['password']:"";
$db_name = isset($_POST['db_name'])?$_POST['db_name']:"";
$db_prefix = isset($_POST['db_prefix'])?$_POST['db_prefix']:"";
$install = isset($_POST['install'])?$_POST['install']:'';
if(!is_writable("./data/config.php")){
echo ("配置文件不可写,请检查配置文件的权限!");
}
$configStr = '<?php $mysql_host='."'{$host}'".';$mysql_user='."'{$user}'".';$mysql_password='."'{$password}'".';
$db_name = '."'{$db_name}'".';$db_prefix = '."'{$db_prefix}'".';?>';
echo $configStr;
$fp = fopen("./data/config.php","w+");
fwrite($fp,$configStr);
//==================================
include_once ("data/config.php");
if(!@$link = mysqli_connect($host,$user,$password)){
echo "数据库连接失败!";
}else{
echo "数据库连接成功!";
$createSql = "create database `$db_name`";
mysqli_query($link, $createSql);
mysqlI_select_db($link,$db_name);
$sql_query[] = "create table `".$db_prefix."_admin_log1`(
`id` int(8) unsigned not null auto_increment key
);";
$sql_query[] = "create table `".$db_prefix."_admin_log2`(
`id` int(8) unsigned not null auto_increment key
);";
foreach($sql_query as $sql){
mysqli_query($link,$sql);
//echo $sql;
echo "导入成功..."."
";
}
}
?>
- 填写主机:
- 用户名:
- 密码:
- 数据库名:
- 数据前缀:
- 提交