<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<title>RHSCMS 1.0 beta5 安装</title>
</head>
<body>
<?php
date_default_timezone_set('PRC');

$db_type = post('db_type');
$db_prefix = post('db_prefix');
$admin_name = post('admin_name');
$admin_pwd = post('admin_pwd');
$re_pwd = post('re_pwd');
$email = post('email');
$en_data = post('en_data');

if($db_type == ''){echo '没有选择数据库';exit();}
if($admin_name == ''){echo '后台帐号不能为空';exit();}
if($admin_pwd == ''){echo '后台密码不能为空';exit();}
if($admin_pwd != $re_pwd){echo '两次输入密码不一致';exit();}
if($email == ''){$email = '627780354@qq.com';}

function post($val)
{
	return isset($_POST[$val])?$_POST[$val]:'';
}
switch($db_type)
{
	case 'mysql':install_mysql();break;
	case 'access':install_access();break;
}
function sql_query($sql)
{
	global $db_type,$conn;
	$flag = 1;
	switch($db_type)
	{
		case 'mysql':if(!mysql_query($sql)){$flag = 0;}break;
		case 'access':if(!$conn->execute($sql)){$flag = 0;}break;
	}
	if(!$flag)
	{
		echo '执行该语句时出错：<br />';
		echo $sql.'<br />';
		echo '安装前请先清空数据库，避免重复创建数据表，如仍有问题，请加入RHSCMS用户QQ群寻求帮助，群号61628043<br />';	
		exit();	
	}
}

function install_mysql()
{
	global $db_host,$db_name,$db_user,$db_pass,$db_prefix;
	$db_host = isset($_POST['db_host'])?$_POST['db_host']:'';
	$db_name = isset($_POST['db_name'])?$_POST['db_name']:'';
	$db_user = isset($_POST['db_user'])?$_POST['db_user']:'';
	$db_pass = isset($_POST['db_pass'])?$_POST['db_pass']:'';
	
	if($db_host == '' || $db_name == '' || $db_user == '')
	{
		echo '数据库信息不足，安装失败<br />';
		exit();
	}
	
	if(mysql_connect($db_host,$db_user,$db_pass))
	{
		if(mysql_select_db($db_name))
		{
			echo '连接数据库成功，正在创建数据表...<br />';
		}else{
			echo '数据库'.$db_name.'不存在，正在创建数据库...<br />';
			if(mysql_query('create database '.$db_name))
			{
				echo '创建数据库成功，重新连接数据库...<br />';
				if(mysql_select_db($db_name))
				{
					echo '数据库链接成功，正在创建数据表...<br />';
				}else{
					echo '连接数据库失败，退出安装，请加入RHSCMS用户QQ群寻求帮助，群号61628043<br />';
					exit();
				}
			}else{
				echo '创建数据库失败，退出安装，请加入RHSCMS用户QQ群寻求帮助，群号61628043<br />';
				exit();
			}
		}
	}else{
		echo '连接数据库失败，请检测您所填写的数据库信息是否正确<br />';
		exit();
	}
	mysql_query('set names utf8');
	
	//创建数据表
	$sql = "create table if not exists ".$db_prefix."admin(
		adm_id int(11) not null primary key auto_increment,
		adm_username varchar(50),
		adm_password varchar(50),
		adm_grade int(11) default 0,
		adm_power text,
		adm_prev_login int(11) default 0,
		adm_last_login int(11) default 0
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."article(
		art_id int(11) not null primary key auto_increment,
		art_cat_id int(11) default 0,
		art_lang varchar(50),
		art_type varchar(50) default 'default',
		art_title varchar(250),
		art_text text,
		art_author varchar(50),
		art_add_time int(11) default 0,
		art_img varchar(250),
		art_best int(11) default 0,
		art_top int(11) default 0,
		art_index int(11) default 0,
		art_show int(11) default 1,
		art_keywords varchar(250),
		art_description varchar(250),
		art_hits int(11) default 0,
		art_url varchar(250)
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."booking(
		boo_id int(11) not null primary key auto_increment,
		boo_user_id int(11) default 0,
		boo_pro_id int(11) default 0,
		boo_lang varchar(50),
		boo_number int(11) default 0,
		boo_text text,
		boo_consignee varchar(50),
		boo_email varchar(50),
		boo_tel varchar(50),
		boo_add_time int(11) default 0,
		boo_reply varchar(250)
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."cat_art(
		cat_id int(11) not null primary key auto_increment,
		cat_parent_id int(11) default 0,
		cat_lang varchar(50),
		cat_name varchar(100),
		cat_template varchar(50),
		cat_best int(11) default 0,
		cat_top int(11) default 0,
		cat_index int(11) default 0,
		cat_show int(11) default 1
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."cat_pro(
		cat_id int(11) not null primary key auto_increment,
		cat_parent_id int(11) default 0,
		cat_lang varchar(50),
		cat_name varchar(100),
		cat_template varchar(50),
		cat_best int(11) default 0,
		cat_top int(11) default 0,
		cat_index int(11) default 0,
		cat_show int(11) default 1
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."comment(
		com_id int(11) not null primary key auto_increment,
		com_user_id int(11) default 0,
		com_lang varchar(50),
		com_type varchar(50),
		com_page_id int(11) default 0,
		com_email varchar(50),
		com_text text,
		com_reply text,
		com_rank int(11) default 0,
		com_add_time int(11) default 0,
		com_show int(11) default 1
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."link(
		lin_id int(11) not null primary key auto_increment,
		lin_lang varchar(50),
		lin_word varchar(50),
		lin_url varchar(250),
		lin_img varchar(250),
		lin_title varchar(100),
		lin_top int(11) default 0,
		lin_index int(11) default 0,
		lin_show int(11) default 1
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."menu(
		men_id int(11) not null primary key auto_increment,
		men_lang varchar(50),
		men_type varchar(100),
		men_name varchar(100),
		men_url varchar(250),
		men_top int(11) default 0,
		men_index int(11) default 0,
		men_show int(11) default 1
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."message(
		mes_id int(11) not null primary key auto_increment,
		mes_user_id int(11) default 0,
		mes_lang varchar(50),
		mes_type varchar(50),
		mes_email varchar(50),
		mes_title varchar(50),
		mes_text text,
		mes_reply text,
		mes_add_time int(11) default 0,
		mes_show int(11) default 1
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."picture(
		pic_id int(11) not null primary key auto_increment,
		pic_lang varchar(50),
		pic_type varchar(50),
		pic_title varchar(50),
		pic_path varchar(250),
		pic_url varchar(250),
		pic_site varchar(50),
		pic_text text,
		pic_add_time int(11) default 0,
		pic_top int(11) default 0,
		pic_index int(11) default 0,
		pic_show int(11) default 1
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	  $sql = "create table if not exists ".$db_prefix."product(
		pro_id int(11) not null primary key auto_increment,
		pro_cat_id int(11) default 0,
		pro_lang varchar(50),
		pro_title varchar(250),
		pro_number varchar(100),
		pro_img varchar(250),
		pro_reduce_img varchar(250),
		pro_more_img text,
		pro_text text,
		pro_price varchar(50),
		pro_attributes text,
		pro_keywords varchar(250),
		pro_description varchar(250),
		pro_hits int(11) default 0,
		pro_add_time int(11) default 0,
		pro_best int(11) default 0,
		pro_top int(11) default 0,
		pro_index int(11) default 0,
		pro_show int(11) default 1,
		pro_url varchar(250)
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."research(
		res_id int(11) not null primary key auto_increment,
		res_user_id int(11) default 0,
		res_lang varchar(50),
		res_add_time int(11) default 0,
		res_text text
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."safe(
		saf_id int(11) not null primary key auto_increment,
		saf_ip varchar(50),
		saf_action varchar(50),
		saf_time int(11) default 0
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."users(
		use_id int(11) not null primary key auto_increment,
		use_username varchar(50),
		use_password varchar(50),
		use_real_name varchar(50),
		use_email varchar(50),
		use_qq varchar(50),
		use_tel varchar(50),
		use_phone varchar(50),
		use_address varchar(250),
		use_birthday int(11) default 0,
		use_sex int(11) default 0,
		use_reg_time int(11) default 0,
		use_prev_login int(11) default 0,
		use_last_login int(11) default 0,
		use_question varchar(50),
		use_answer varchar(50)
		) engine=myisam default charset=utf8";
	sql_query($sql);
	
	$sql = "create table if not exists ".$db_prefix."varia(
		var_id int(11) not null primary key auto_increment,
		var_lang varchar(50) default 'none',
		var_name varchar(50),
		var_value varchar(250),
		var_text text
		) engine=myisam default charset=utf8";
	sql_query($sql);
}

function install_access()
{
	global $conn,$db_name,$db_prefix;
	$random = str_pad(mt_rand(1,pow(10,8) - 1),8,'0',STR_PAD_LEFT);
	$random .= str_pad(mt_rand(1,pow(10,8) - 1),8,'0',STR_PAD_LEFT);
	$random .= str_pad(mt_rand(1,pow(10,8) - 1),8,'0',STR_PAD_LEFT);
	$db_name = '#' . $random . '.mdb';
	$database = '../data/' . $db_name;
	if(!copy('#data.mdb',$database))
	{
		echo '复制文件失败，您的网站目录可能没有写入权限，或者没有启用父路径，<br />';
		echo '如果无法解决，请加入RHSCMS用户QQ群寻求帮助，群号61628043<br />';
		exit();
	}
	$connstr = 'provider=microsoft.jet.oledb.4.0;data source='.realpath($database);
	$conn = new com('adodb.connection',NULL,65001);
	$conn->open($connstr);
	
	//创建数据表
	$sql = "create table ".$db_prefix."admin(
		adm_id long identity primary key,
		adm_username varchar(50),
		adm_password varchar(50),
		adm_grade long default 0,
		adm_power text,
		adm_prev_login long default 0,
		adm_last_login long default 0
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."article(
		art_id long identity primary key,
		art_cat_id long default 0,
		art_lang varchar(50),
		art_type varchar(50) default 'default',
		art_title varchar(250),
		art_text text,
		art_author varchar(50),
		art_add_time long default 0,
		art_img varchar(250),
		art_best long default 0,
		art_top long default 0,
		art_index long default 0,
		art_show long default 1,
		art_keywords varchar(250),
		art_description varchar(250),
		art_hits long default 0,
		art_url varchar(250)
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."booking(
		boo_id long identity primary key,
		boo_user_id long default 0,
		boo_pro_id long default 0,
		boo_lang varchar(50),
		boo_number long default 0,
		boo_text text,
		boo_consignee varchar(50),
		boo_email varchar(50),
		boo_tel varchar(50),
		boo_add_time long default 0,
		boo_reply varchar(250)
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."cat_art(
		cat_id long identity primary key,
		cat_parent_id long default 0,
		cat_lang varchar(50),
		cat_name varchar(100),
		cat_template varchar(50),
		cat_best long default 0,
		cat_top long default 0,
		cat_index long default 0,
		cat_show long default 1
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."cat_pro(
		cat_id long identity primary key,
		cat_parent_id long default 0,
		cat_lang varchar(50),
		cat_name varchar(100),
		cat_template varchar(50),
		cat_best long default 0,
		cat_top long default 0,
		cat_index long default 0,
		cat_show long default 1
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."comment(
		com_id long identity primary key,
		com_user_id long default 0,
		com_lang varchar(50),
		com_type varchar(50),
		com_page_id long default 0,
		com_email varchar(50),
		com_text text,
		com_reply text,
		com_rank long default 0,
		com_add_time long default 0,
		com_show long default 1
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."link(
		lin_id long identity primary key,
		lin_lang varchar(50),
		lin_word varchar(50),
		lin_url varchar(250),
		lin_img varchar(250),
		lin_title varchar(100),
		lin_top long default 0,
		lin_index long default 0,
		lin_show long default 1
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."menu(
		men_id long identity primary key,
		men_lang varchar(50),
		men_type varchar(100),
		men_name varchar(100),
		men_url varchar(250),
		men_top long default 0,
		men_index long default 0,
		men_show long default 1
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."message(
		mes_id long identity primary key,
		mes_user_id long default 0,
		mes_lang varchar(50),
		mes_type varchar(50),
		mes_email varchar(50),
		mes_title varchar(50),
		mes_text text,
		mes_reply text,
		mes_add_time long default 0,
		mes_show long default 1
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."picture(
		pic_id long identity primary key,
		pic_lang varchar(50),
		pic_type varchar(50),
		pic_title varchar(50),
		pic_path varchar(250),
		pic_url varchar(250),
		pic_site varchar(50),
		pic_text text,
		pic_add_time long default 0,
		pic_top long default 0,
		pic_index long default 0,
		pic_show long default 1
		)";
	sql_query($sql);
	
	  $sql = "create table ".$db_prefix."product(
		pro_id long identity primary key,
		pro_cat_id long default 0,
		pro_lang varchar(50),
		pro_title varchar(250),
		pro_number varchar(100),
		pro_img varchar(250),
		pro_reduce_img varchar(250),
		pro_more_img text,
		pro_text text,
		pro_price varchar(50),
		pro_attributes text,
		pro_keywords varchar(250),
		pro_description varchar(250),
		pro_hits long default 0,
		pro_add_time long default 0,
		pro_best long default 0,
		pro_top long default 0,
		pro_index long default 0,
		pro_show long default 1,
		pro_url varchar(250)
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."research(
		res_id long identity primary key,
		res_user_id long default 0,
		res_lang varchar(50),
		res_add_time long default 0,
		res_text text
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."safe(
		saf_id long identity primary key,
		saf_ip varchar(50),
		saf_action varchar(50),
		saf_time long default 0
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."users(
		use_id long identity primary key,
		use_username varchar(50),
		use_password varchar(50),
		use_real_name varchar(50),
		use_email varchar(50),
		use_qq varchar(50),
		use_tel varchar(50),
		use_phone varchar(50),
		use_address varchar(250),
		use_birthday long default 0,
		use_sex long default 0,
		use_reg_time long default 0,
		use_prev_login long default 0,
		use_last_login long default 0,
		use_question varchar(50),
		use_answer varchar(50)
		)";
	sql_query($sql);
	
	$sql = "create table ".$db_prefix."varia(
		var_id long identity primary key,
		var_lang varchar(50) default 'none',
		var_name varchar(50),
		var_value varchar(250),
		var_text text
		)";
	sql_query($sql);
}

//添加默认数据
//sql_query("insert into () values ('')")
include('default_data.php');

sql_query("insert into ".$db_prefix."admin (adm_username,adm_password,adm_grade,adm_power) values ('$admin_name','".md5($admin_pwd)."','1','all')");

sql_query("insert into ".$db_prefix."article (art_lang,art_type,art_title,art_text,art_top) values ('zh-cn','about','公司简介','技术交流群：sinsiu③群 61628043，作者QQ：627780354','1')");
sql_query("insert into ".$db_prefix."article (art_lang,art_type,art_title,art_text) values ('zh-cn','about','企业文化','企业文化')");
sql_query("insert into ".$db_prefix."article (art_lang,art_type,art_title,art_text) values ('zh-cn','about','成功案例','成功案例')");

sql_query("insert into ".$db_prefix."cat_art (cat_lang,cat_parent_id,cat_name,cat_best) values ('zh-cn','0','文章一类','1')");
sql_query("insert into ".$db_prefix."cat_art (cat_lang,cat_parent_id,cat_name,cat_best) values ('zh-cn','0','文章二类','1')");
sql_query("insert into ".$db_prefix."cat_art (cat_lang,cat_parent_id,cat_name,cat_best) values ('zh-cn','1','文章三类','0')");
sql_query("insert into ".$db_prefix."cat_pro (cat_lang,cat_parent_id,cat_name,cat_best) values ('zh-cn','0','产品一类','1')");
sql_query("insert into ".$db_prefix."cat_pro (cat_lang,cat_parent_id,cat_name,cat_best) values ('zh-cn','0','产品二类','1')");
sql_query("insert into ".$db_prefix."cat_pro (cat_lang,cat_parent_id,cat_name,cat_best) values ('zh-cn','1','产品三类','0')");

sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','首页','index/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','关于我们','about/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','产品展示','product/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','资讯中心','article/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','人才招聘','recruit/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','下载中心','download/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','留言板','message/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','用户中心','user/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','header','红头船官网','http://www.rhscms.com')");

sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','footer','首页','index/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','footer','关于我们','about/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','footer','产品展示','product/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','footer','资讯中心','article/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','footer','人才招聘','recruit/')");

sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','about','公司简介','about/id-1/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','about','企业文化','about/id-2/')");
sql_query("insert into ".$db_prefix."menu (men_lang,men_type,men_name,men_url) values ('zh-cn','about','成功案例','about/id-3/')");

sql_query("insert into ".$db_prefix."picture (pic_lang,pic_type,pic_path,pic_site,pic_title,pic_url) values ('zh-cn','focus','images/focus_2.jpg','default','焦点图片','index.php')");
sql_query("insert into ".$db_prefix."picture (pic_lang,pic_type,pic_path,pic_site,pic_title,pic_url) values ('zh-cn','focus','images/focus_1.jpg','default','焦点图片','index.php')");

sql_query("insert into ".$db_prefix."link (lin_lang,lin_word,lin_url,lin_img,lin_title,lin_index) values ('zh-cn','广州兼职网','http://www.jianzhinet.com','none','广州兼职网','10')");
sql_query("insert into ".$db_prefix."link (lin_lang,lin_word,lin_url,lin_img,lin_title,lin_index) values ('zh-cn','水处理设备','http://www.twbuder.com','none','水处理设备','9')");

sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','site_title','红头船企业网站系统 RHSCMS 1.0 beta5')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('none','site_admin_title','红头船企业网站系统 RHSCMS 1.0 beta5 - 后台')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','site_name','红头船工作室')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('none','site_domain','www.rhscms.com')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','site_record','粤ICP备12345678号')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('none','site_record_url','http://www.rhscms.com')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','site_tech','红头船工作室')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('none','site_tech_url','http://www.rhscms.com')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','site_keywords','网站关键字')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','site_description','网站描述')");

sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','联系人{v}陈湘国')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','电话{v}15919510148')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','手机{v}15919510148')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','传真{v}15919510148')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','邮编{v}521011')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','地址{v}广东省潮州市湘桥区景山村')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','网址{v}www.rhscms.com')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','QQ/MSN{v}627780354')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','contact','电子邮件{v}$email')");

sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','title','about{v}关于我们{v}10')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','title','product{v}产品展示{v}10')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','title','article{v}资讯中心{v}10')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','title','recruit{v}人才招聘{v}10')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','title','download{v}下载中心{v}10')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','title','message{v}留言板{v}10')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','title','user{v}用户中心{v}10')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','title','search{v}搜索结果{v}10')");

sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','research','您是如何知道本网站的？{v}radio{v}广告{v}名片{v}搜索引擎')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('zh-cn','research','您认为本公司产品质量如何？{v}radio{v}很好{v}一般{v}很差')");

sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_text) values ('none','statistical_code','统计代码')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_text) values ('none','share_code','$share_code')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_text) values ('zh-cn','notice','网站公告')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_text) values ('zh-cn','service_code','在线客服')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_text) values ('zh-cn','user_agreement','用户协议')");

sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('languages','zh-cn{v}index.php{v}admin.php{v}中文{v}中文')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('languages','en-us{v}en.php{v}en_admin.php{v}英文{v}English')");

sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('about_filter','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('about_len','520')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('index_img_list_len','8')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('index_art_list_len','5')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('img_list_len','12')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('art_list_len','15')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('reduce_img_width','160')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('reduce_img_height','160')");

sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_admin_login_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_admin_login_times','10')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_user_login_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_user_login_times','20')");

sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_register_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_register_times','3')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_message_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_message_times','3')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_comment_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_comment_times','20')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_research_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_research_times','3')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_booking_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_booking_times','20')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_edit_user_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_edit_user_times','10')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_edit_pwd_hours','1')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('safe_edit_pwd_times','3')");

sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('sentmail','0')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('sentmail_smtp','smtp.163.com')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('sentmail_send','rhscms_1_0_5@163.com')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('sentmail_password','rhscms105')");
sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('sentmail_receive','$email')");

sql_query("insert into ".$db_prefix."varia (var_name,var_value) values ('version','RHSCMS 1.0 beta5')");

sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_text) values ('en-us','notice','Notice')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_text) values ('en-us','service_code','Service')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_text) values ('en-us','user_agreement','User Agreement')");

sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('en-us','site_title','RHSCMS 1.0 beta5')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('en-us','site_name','RedHeadShip')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('en-us','site_record','粤ICP备12345678号')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('en-us','site_tech','RedHeadShip')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('en-us','site_keywords','Keywords')");
sql_query("insert into ".$db_prefix."varia (var_lang,var_name,var_value) values ('en-us','site_description','Description')");

if($en_data == 1)
{
	include('en_data.php');
}

//修改配置文件
$file = file_get_contents('config.php');
switch($db_type)
{
	case 'mysql':
	  $file = str_replace("\$config['S_DB_TYPE'] = '';","\$config['S_DB_TYPE'] = 'mysql';",$file);
	  $file = str_replace("\$config['S_DB_PATH'] = '';","\$config['S_DB_PATH'] = '".$db_host."';",$file);
	  $file = str_replace("\$config['S_DB_NAME'] = '';","\$config['S_DB_NAME'] = '".$db_name."';",$file);
	  $file = str_replace("\$config['S_DB_USER'] = '';","\$config['S_DB_USER'] = '".$db_user."';",$file);
	  $file = str_replace("\$config['S_DB_PWD'] = '';","\$config['S_DB_PWD'] = '".$db_pass."';",$file);
	  $file = str_replace("\$config['S_DB_PREFIX'] = '';","\$config['S_DB_PREFIX'] = '".$db_prefix."';",$file);
	break;
	case 'access':
	  $file = str_replace("\$config['S_DB_TYPE'] = '';","\$config['S_DB_TYPE'] = 'access';",$file);
	  $file = str_replace("\$config['S_DB_PATH'] = '';","\$config['S_DB_PATH'] = 'data/';",$file);
	  $file = str_replace("\$config['S_DB_NAME'] = '';","\$config['S_DB_NAME'] = '".$db_name."';",$file);
	  $file = str_replace("\$config['S_DB_PREFIX'] = '';","\$config['S_DB_PREFIX'] = '".$db_prefix."';",$file);
	break;
}
file_put_contents('../include/config.php',$file);

copy('site_index.php','../index.php');
  
?>
安装成功，为了避免留下安全隐患，<a href="del.php">请点击这里删除安装文件</a>
</body>
</html>