include "lib.html";
include "schema.sql";
if(file_exists("config.html")) error("config.html文件已经存在.
若要重新安装,安装前请删除config.html文件!");
// 检查HOSTNAME,ID,数据库名,密码
if(isBlank($hostname)) Error("请输入主机名","");
if(isBlank($user_id)) Error("请输入MySQL用户名","");
if(isBlank($dbname)) Error("请输入数据库名","");
// 连接数据库,根据数据库名选择数据库
$connect = @mysql_connect($hostname,$user_id,$password) or Error("MySQL-DB Connect
Error!!!","");
if(mysql_error()) Error(mysql_error(),"");
mysql_select_db($dbname, $connect ) or Error("MySQL-DB Select
Error!!!","");
// 生成管理员数据表
if(!isTable($admin_table,$dbname)) @mysql_query($admin_table_schema, $connect) or Error("管理员数据表生成失败.","");
else $admin_table_exist=1;
// 生成论坛数据表
if(!isTable($group_table,$dbname)) @mysql_query($group_table_schema, $connect) or Error("论坛数据表生成失败.","");
else $group_table_exist=1;
// 生成会员管理数据表
if(!istable($member_table,$dbname)) @mysql_query($member_table_schema, $connect) or Error("会员管理表生成失败.","");
else $member_table_exist=1;
// 短消息数据表
if(!istable($get_memo_table,$dbname)) @mysql_query($get_memo_table_schema, $connect) or Error("接受短信息数据表生成失败.");
else $get_memo_table_exists=1;
if(!istable($send_memo_table,$dbname)) @mysql_query($send_memo_table_schema, $connect) or Error("发送短消息数据表生成失败.");
else $send_memo_table_exist=1;
// 文件里保存DB信息
$file=@fopen("config.html","w") or Error("config.html生成失败
把目录的文件权限改成707!","");
@fwrite($file,"\n$hostname\n$user_id\n$password\n$dbname\n?>\n") or Error("config.html生成失败
把目录的文件权限改成707!","");
@fclose($file);
@mkdir("data",0707);
@mkdir("icon",0707);
@mkdir("icon/member_image_box",0707);
@mkdir("icon/private_icon",0707);
@mkdir("icon/private_name",0707);
@chmod("icon/member_image_box",0707);
@chmod("icon/private_icon",0707);
@chmod("icon/private_name",0707);
@chmod("data",0707);
@chmod("icon",0707);
@chmod("config.html",0707);
$temp=mysql_fetch_array(mysql_query("select count(*) from $member_table where is_admin = '1'",$connect));
mysql_close($connect);
if($temp[0]) {movepage("admin.html");}
else {movepage("install2.html");} // 无管理员信息时输入管理员信息
?>