<!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" />
<title>162100升级</title>
</head>

<body>
<h2>向6.3升级</h2>
<p><a href="?fr=5.7">5.7升级</a></p>
<p><a href="?fr=6">6.*升级</a></p>
<?php

//@ini_set('default_charset', 'utf-8');
//@ini_set('display_errors', false);
//error_reporting(E_ERROR | E_WARNING | E_PARSE);
//error_reporting(E_ALL);

/*
if (!file_exists('v.txt')) {
  die('&#x5347;&#x7EA7;&#x65E0;&#x6CD5;&#x8FDB;&#x884C;&#xFF01;&#xFF08;&#x4F60;&#x628A;&#x8BB0;&#x8F7D;&#x7248;&#x672C;&#x7684;&#x6587;&#x4EF6;&#x5F04;&#x6CA1;&#x4E86;&#xFF01;&#xFF09;');
}

@ include ('v.txt');
if (!isset($v)) {
  die('&#x5347;&#x7EA7;&#x65E0;&#x6CD5;&#x8FDB;&#x884C;&#xFF01;&#xFF08;&#x65E0;&#x6CD5;&#x786E;&#x5B9A;&#x7248;&#x672C;&#xFF0C;&#x4F60;&#x53EF;&#x80FD;&#x628A;&#x8BB0;&#x8F7D;&#x7248;&#x672C;&#x7684;&#x6587;&#x4EF6;&#x5F04;&#x6CA1;&#x4E86;&#xFF01;&#xFF09;');
}
$v = base64_decode($v);
if ($v < 5.7) {
  die('&#x7248;&#x672C;&#x592A;&#x4F4E;&#x4E86;&#xFF0C;&#x65E0;&#x6CD5;&#x5BF9;&#x6B64;&#x7248;&#x8FDB;&#x884C;&#x5347;&#x7EA7;&#xFF01;');
}
*/
if (!(isset($_GET['fr']) && $_GET['fr'])) {
  die('请选择升级版本！</body>
</html>
');
}

include ('readonly/function/write_file.php');

if (/*$v >= 5.7 && $v <6*/$_GET['fr'] == 5.7) {
  include ('set/set.php');

  write_file('writable/set/set.php', '<?php
@ini_set(\'default_charset\', \'utf-8\');
@ini_set(\'display_errors\', false);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
if (PHP_VERSION < \'4.1.0\') {
  $_GET = &$HTTP_GET_VARS;
  $_POST = &$HTTP_POST_VARS;
  $_COOKIE = &$HTTP_COOKIE_VARS;
  $_SERVER = &$HTTP_SERVER_VARS;
  $_ENV = &$HTTP_ENV_VARS;
  $_FILES = &$HTTP_POST_FILES;
}

/* ----------【网站设置】能不用尽量不要用特殊符号，如 \ / : ; * ? \' < > | ，必免导致错误--------- */

//基本设置：
$web[\'code_author\'] = \'\'; //base64_decode(\'IC0gUG93ZXJlZCBieSAxNjIxMDAuY29t\');

$web[\'manager\'] = \''.$web['manager'].'\';  //基础管理员名称
$web[\'password\'] = \''.$web['password'].'\';  //基础管理员密码，注：系统出现一切故障时以基础管理员名称和密码为准

$web[\'sitehttp\'] = \'http://\'.(!empty($_SERVER[\'HTTP_X_FORWARDED_HOST\']) ? $_SERVER[\'HTTP_X_FORWARDED_HOST\'] : $_SERVER[\'HTTP_HOST\']).\'/\';  //站点网址
$web[\'path\'] = dirname(trim($web[\'sitehttp\'], \'/\').$_SERVER[\'REQUEST_URI\']).\'/\';  //路径
$web[\'sitename\'] = \''.$web['sitename'].'\';  //站点名称
$web[\'sitename2\'] = \''.$web['sitename2'].'\';  //站点简称
$web[\'description\'] = \''.$web['description'].'\';  //站点描述
$web[\'keywords\'] = \''.$web['keywords'].'\';  //关键字
$web[\'slogan\'] = \''.$web['slogan'].'\';  //口号
$web[\'link_type\'] = '.$web['link_type'].';  //通过export.php?url=链接路径 中转链接
$web[\'login_key\'] = '.var_export($web['login_key'], true).';

$web[\'chmod\'] = \''.$web['chmod'].'\';  //权限
if (empty($web[\'chmod\']) || $web[\'chmod\'] < 755) {
  $web[\'chmod\'] = 755;
}
$web[\'time_pos\'] = \''.$web['time_pos'].'\';  //服务器时区调整
$web[\'cssfile\'] = \'qq/1\';  //站点默认风格
$web[\'search_bar\'] = '.$web['search_bar'].';  //默认搜索引擎样式

$web[\'stop_reg\'] = '.$web['stop_reg'].';  //用户注册 1禁止 0不禁止 2注册需审核
$web[\'mail_send\'] = '.$web['mail_send'].';  //1发送邮件 0不发送
$web[\'stop_login\'] = '.$web['stop_login'].';  //用户登录密码错误限数 0不限

$web[\'addfunds\'] = '.$web['addfunds'].';  //1开启用户创收模式
$web[\'loginadd\'] = '.$web['loginadd'].';  //用户登陆（含注册）、推广URL来访本站赠送货币值
$web[\'loginadd2\'] = '.$web['loginadd2'].';  //从上线分成
$web[\'loginadd_limit_ip\'] = '.$web['loginadd_limit_ip'].';  //每IP每日限注册次数计赠货币值
$web[\'cash\'] = '.$web['cash'].';  //用户提现需达到

?>');

  include ('set/set_area.php');
  $linshi = array();
  $linshi['homepage'] = $web['area']['index'];
  $linshi['mingz'] = $web['area']['mingz'];
  unset($web['area']['index'], $web['area']['mingz']);
  $array_new = $linshi + $web['area'];

  write_file('writable/set/set_area.php', '<?php
$web[\'area\'] = '.var_export($array_new, true).';

if (!function_exists(\'get_column_html\')) {
  function get_column_html($column_id) {
    global $web;
    return $web[\'html\'] == true ? \'\'.$web[\'area\'][$column_id][\'name\'][1].\'.html\' : \'column.php?column_id=\'.$column_id.\'\';
  }
}
if (!function_exists(\'get_class_html\')) {
  function get_class_html($column_id, $class_id) {
    global $web;
    return $web[\'html\'] == true ? \'\'.$web[\'area\'][$column_id][\'name\'][1].\'_\'.$web[\'area\'][$column_id][$class_id][1].\'.html\' : \'class.php?column_id=\'.$column_id.\'&class_id=\'.$class_id.\'\';
  }
}

?>');

  unset($web);

  include ('set/set_sql.php');
  $sql['data'] = array(
'承载网址数据的表名' => '162100',
'承载成员档案的表名' => 'member',
'承载财务数据的表名' => 'myaccount',
);

  write_file('writable/set/set_sql.php', '<?php
$sql = '.var_export($sql, true).';

//连接数据库
if (!function_exists(\'db_conn\')) {
  function db_conn() {
    global $sql, $db;
    if ($db = @mysql_connect($sql[\'host\'].\':\'.$sql[\'port\'], $sql[\'user\'], $sql[\'pass\'])) {
      if (@mysql_select_db($sql[\'name\'], $db)) {
        @mysql_query(\'SET NAMES \'.$sql[\'char\'].\'\');
        $sql[\'db_err\'] = \'\';
        return true;
      } else {
        $sql[\'db_err\'] = mysql_errno().\':\'.mysql_error().\'<br>&#25968;&#25454;&#24211;[\'.$sql[\'name\'].\']&#36830;&#25509;&#19981;&#25104;&#21151;&#65281;<a href="forsql.html" target="_blank" class="underline">&#22914;&#20309;&#35299;&#20915;&#65311;</a>\';
        return false;
      }
    } else {
      $sql[\'db_err\'] = mysql_errno().\':\'.mysql_error().\'<br>&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;[\'.$sql[\'host\'].\':\'.$sql[\'port\'].\']&#36830;&#25509;&#19981;&#25104;&#21151;&#65281;<a href="forsql.html" target="_blank" class="underline">&#22914;&#20309;&#35299;&#20915;&#65311;</a>\';
      return false;
    }
  }
}
?>');

  //unset($sql);
include ('writable/set/set.php');


if (!isset($sql['db_err'])) {
  db_conn();
}
if ($sql['db_err'] == '') {
  @mysql_query('UPDATE `'.$sql['pref'].''.$sql['data']['承载网址数据的表名'].'` SET column_id=REPLACE(column_id, "index", "homepage")', $db);
  echo 'mysql update OK!';
} else {
  echo ''.$sql['db_err'].'';
}
@mysql_close();

  @ unlink('./index.html');

  die('&#x5347;&#x7EA7;&#x5B8C;&#x6BD5;&#x3002;<a href="./">&#x8FDB;&#x5165;&#x9996;&#x9875;</a></body>
</html>');
}



if (/*$v >= 6 && $v <= 6.2*/$_GET['fr'] == 6) {
  include ('writable/set/set.php');
  write_file('writable/set/set.php', '<?php
@ini_set(\'default_charset\', \'utf-8\');
@ini_set(\'display_errors\', false);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
if (PHP_VERSION < \'4.1.0\') {
  $_GET = &$HTTP_GET_VARS;
  $_POST = &$HTTP_POST_VARS;
  $_COOKIE = &$HTTP_COOKIE_VARS;
  $_SERVER = &$HTTP_SERVER_VARS;
  $_ENV = &$HTTP_ENV_VARS;
  $_FILES = &$HTTP_POST_FILES;
}

/* ----------【网站设置】能不用尽量不要用特殊符号，如 \ / : ; * ? \' < > | ，必免导致错误--------- */

//基本设置：
$web[\'code_author\'] = \'\'; //base64_decode(\'IC0gUG93ZXJlZCBieSAxNjIxMDAuY29t\');

$web[\'manager\'] = \''.$web['manager'].'\';  //基础管理员名称
$web[\'password\'] = \''.$web['password'].'\';  //基础管理员密码，注：系统出现一切故障时以基础管理员名称和密码为准

$web[\'sitehttp\'] = \'http://\'.(!empty($_SERVER[\'HTTP_X_FORWARDED_HOST\']) ? $_SERVER[\'HTTP_X_FORWARDED_HOST\'] : $_SERVER[\'HTTP_HOST\']).\'/\';  //站点网址
$web[\'path\'] = dirname(trim($web[\'sitehttp\'], \'/\').$_SERVER[\'REQUEST_URI\']).\'/\';  //路径
$web[\'sitename\'] = \''.$web['sitename'].'\';  //站点名称
$web[\'sitename2\'] = \''.$web['sitename2'].'\';  //站点简称
$web[\'description\'] = \''.$web['description'].'\';  //站点描述
$web[\'keywords\'] = \''.$web['keywords'].'\';  //关键字
$web[\'slogan\'] = \''.$web['slogan'].'\';  //口号
$web[\'link_type\'] = '.$web['link_type'].';  //通过export.php?url=链接路径 中转链接
$web[\'login_key\'] = '.var_export($web['login_key'], true).';

$web[\'chmod\'] = \''.$web['chmod'].'\';  //权限
if (empty($web[\'chmod\']) || $web[\'chmod\'] < 755) {
  $web[\'chmod\'] = 755;
}
$web[\'time_pos\'] = \''.$web['time_pos'].'\';  //服务器时区调整
$web[\'cssfile\'] = \'qq/2\';  //站点默认风格
$web[\'search_bar\'] = '.$web['search_bar'].';  //默认搜索引擎样式

$web[\'stop_reg\'] = '.$web['stop_reg'].';  //用户注册 1禁止 0不禁止 2注册需审核
$web[\'mail_send\'] = '.$web['mail_send'].';  //1发送邮件 0不发送
$web[\'stop_login\'] = '.$web['stop_login'].';  //用户登录密码错误限数 0不限

$web[\'addfunds\'] = '.$web['addfunds'].';  //1开启用户创收模式
$web[\'loginadd\'] = '.$web['loginadd'].';  //用户登陆（含注册）、推广URL来访本站赠送货币值
$web[\'loginadd2\'] = '.$web['loginadd2'].';  //从上线分成
$web[\'loginadd_limit_ip\'] = '.$web['loginadd_limit_ip'].';  //每IP每日限注册次数计赠货币值
$web[\'cash\'] = '.$web['cash'].';  //用户提现需达到

?>');

  //$css = array('default', 'jieri', 'qq', 'taodianpu');

  $cssfiles = @glob('writable/css/*', GLOB_ONLYDIR);
  $css_n = count($cssfiles);

  if ($css_n > 0) {
    foreach ($cssfiles as $css) {
      $css = basename($css);
      if (is_numeric($css)) {
	    deldir('writable/css/'.$css);
	  }
    }
  }

  @ unlink('./index.html');
  @ unlink('./index_162100.php');
  @ unlink('./index_162100_2.php');
  @ unlink('./index_162100_3.php');
  @ unlink('./index_hiddenmenu.php');
  @ unlink('./writable/css/default/0.css');
  @ unlink('./writable/css/default/00.css');

  die('&#x5347;&#x7EA7;&#x5B8C;&#x6BD5;&#x3002;<a href="./">&#x8FDB;&#x5165;&#x9996;&#x9875;</a></body>
</html>');

}


//连接数据库
if (!function_exists('db_conn')) {
  function db_conn() {
    global $sql, $db;
    if ($db = @mysql_connect($sql['host'].':'.$sql['port'], $sql['user'], $sql['pass'])) {
      if (@mysql_select_db($sql['name'], $db)) {
        @mysql_query('SET NAMES '.$sql['char'].'');
        $sql['db_err'] = '';
        return true;
      } else {
        $sql['db_err'] = mysql_errno().':'.mysql_error().'<br>&#25968;&#25454;&#24211;['.$sql['name'].']&#36830;&#25509;&#19981;&#25104;&#21151;&#65281;<a href="forsql.html" target="_blank" class="underline">&#22914;&#20309;&#35299;&#20915;&#65311;</a>';
        return false;
      }
    } else {
      $sql['db_err'] = mysql_errno().':'.mysql_error().'<br>&#25968;&#25454;&#24211;&#26381;&#21153;&#22120;['.$sql['host'].':'.$sql['port'].']&#36830;&#25509;&#19981;&#25104;&#21151;&#65281;<a href="forsql.html" target="_blank" class="underline">&#22914;&#20309;&#35299;&#20915;&#65311;</a>';
      return false;
    }
  }
}

//删除目录
function deldir($dir) {
  if (empty($dir) || !file_exists($dir)) return;
  if ($fp = @opendir($dir)) {
    while (false !== ($file = @readdir($fp))) {
      if ($file != '.' && $file != '..') {
        if (is_dir($dir.'/'.$file)) {
          deldir($dir.'/'.$file);
        } else {
          @unlink($dir.'/'.$file);
        }
      }
    }
    if (readdir($fp) == false) {
      @closedir($fp);
      if (@rmdir($dir)) {
        return true;
      }
    }
  }
}



/* 栏目 - 即小类 */

/*
@ include ('writable/set/set.php');
if (!isset($sql)) {
  @ include ('writable/set/set_sql.php');
}

if (!isset($sql['db_err'])) {
  db_conn();
}
if ($sql['db_err'] == '') {
  @mysql_query('UPDATE `'.$sql['pref'].''.$sql['data']['承载网址数据的表名'].'` SET column_id=REPLACE(column_id, "index", "homepage")', $db);
  echo 'OK!';
} else {
  echo ''.$sql['db_err'].'';
}

@mysql_close();
*/

?>
</body>
</html>
