<!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>升级至RHSB2C 1.0 beta2</title>
</head>
<body>
<?php
date_default_timezone_set('PRC');
include('../include/config.php');
include('../include/function.php');
	
$db_host = S_DB_PATH;
$db_name = S_DB_NAME;
$db_user = S_DB_USER;
$db_pass = S_DB_PWD;
$db_prefix = S_DB_PREFIX;
	
switch(S_DB_TYPE)
{
	case 'mysql':
		mysql_connect(S_DB_PATH,S_DB_USER,S_DB_PWD) or die('Could not connect:'.mysql_error());
		mysql_select_db(S_DB_NAME) or die('Could not select database');
		mysql_query('set names utf8');
	break;
	case 'access':
		$str = 'provider=microsoft.jet.oledb.4.0;data source='.realpath('../'.S_DB_PATH.S_DB_NAME);
		$conn = new com('adodb.connection',NULL,65001);
		$conn->open($str);
	break;
}
	
function sql_query($sql)
{
	global $conn;
	switch(S_DB_TYPE)
	{
		case 'mysql':mysql_query($sql);break;
		case 'access':$conn->execute($sql);break;
	}
}
	
switch(S_DB_TYPE)
{
	case 'mysql':install_mysql();break;
	case 'access':install_access();break;
}
	
function install_mysql()
{
}
	
function install_access()
{
}
	
sql_query("alter table ".$db_prefix."cat_art drop column cat_type");
sql_query("alter table ".$db_prefix."cat_goo drop column cat_type");
	
sql_query("delete from ".$db_prefix."varia where var_name = 'safe_research_hours'");
sql_query("delete from ".$db_prefix."varia where var_name = 'safe_research_times'");
	
sql_query("update ".$db_prefix."varia set var_value = 'RHSB2C 1.0 beta2' where var_name = 'version'");
	
del_dir('../admin');
del_dir('../index');
del_dir('../templates/default');
	
copy_dir('new/admin','../admin');
copy_dir('new/index','../index');
copy_dir('new/templates/default','../templates/default');
	
?>
升级成功，为了避免留下安全隐患，<a href="del.php">请点击这里删除升级文件</a>
</body>
</html>