<?php
$install = true;
require_once('../includes/common.php');
@header('Content-Type: text/html; charset=UTF-8');
/**if($conf['version']<1039){
	exit('网站程序版本太旧，不支持直接升级');
}else*/
if($conf['version']<1004){
	$sqls = file_get_contents('../includes/update.sql');
	$version = 1004;
}else{
	exit('你的网站已经升级到最新版本了');
}
$explode = explode(';', $sqls);
$num = count($explode);
foreach ($explode as $sql) {
    if ($sql = trim($sql)) {
        $DB->query($sql);
    }
}
saveSetting('version',$version);
$CACHE->clear();
exit("<script language='javascript'>alert('网站数据库升级完成！');window.location.href='../';</script>");
?>