打开function/common.func.php文件,找到下面一个 dbconect 函数,将其改为:- //连接数据库
- function dbconnect($mode=0) {
- global $_SGLOBAL, $_SC;
- if(empty($_SGLOBAL['db'])) {
- include_once(S_ROOT.'./class/db_mysql.class.php');
- $_SGLOBAL['db'] = new dbstuff;
- $_SGLOBAL['db']->charset = $_SC['dbcharset'];
- $_SGLOBAL['db']->connect($_SC['dbhost'], $_SC['dbuser'], $_SC['dbpw'], $_SC['dbname'], $_SC['pconnect']);
- }
- if($mode==1) {
- if(empty($_SGLOBAL['db_bbs'])) {
- if($_SC['dbhost'] == $_SC['dbhost_bbs'] && $_SC['dbuser'] == $_SC['dbuser_bbs'] && $_SC['dbcharset'] == $_SC['dbcharset_bbs']) {
- //同一台服务器
- $_SGLOBAL['db_bbs'] = $_SGLOBAL['db'];
- } else {
- //不同的mysql服务器
- include_once(S_ROOT.'./class/db_mysql.class.php');
- $newlink = $_SC['dbhost'] == $_SC['dbhost_bbs'] && $_SC['dbuser'] == $_SC['dbuser_bbs'] && $_SC['dbcharset'] != $_SC['dbcharset_bbs'] ? 1 : 0;
- $_SGLOBAL['db_bbs'] = new dbstuff;
- $_SGLOBAL['db_bbs']->charset = $_SC['dbcharset_bbs'];
- $_SGLOBAL['db_bbs']->connect($_SC['dbhost_bbs'], $_SC['dbuser_bbs'], $_SC['dbpw_bbs'], $_SC['dbname_bbs'], $_SC['pconnect_bbs'], 1);
- }
- }
- } elseif($mode==2) {
- if(empty($_SGLOBAL['db_uch'])) {
- if($_SC['dbhost'] == $_SC['dbhost_uch'] && $_SC['dbuser'] == $_SC['dbuser_uch'] && $_SC['dbcharset'] == $_SC['dbcharset_uch']) {
- //同一台服务器
- $_SGLOBAL['db_uch'] = $_SGLOBAL['db'];
- } else {
- //不同的mysql服务器
- include_once(S_ROOT.'./class/db_mysql.class.php');
- $newlink = $_SC['dbhost'] == $_SC['dbhost_uch'] && $_SC['dbuser'] == $_SC['dbuser_uch'] && $_SC['dbcharset'] != $_SC['dbcharset_uch'] ? 1 : 0;
- $_SGLOBAL['db_uch'] = new dbstuff;
- $_SGLOBAL['db_uch']->charset = $_SC['dbcharset_uch'];
- $_SGLOBAL['db_uch']->connect($_SC['dbhost_uch'], $_SC['dbuser_uch'], $_SC['dbpw_uch'], $_SC['dbname_uch'], $_SC['pconnect_uch'], $newlink);
- }
- }
- }
- }
复制代码 |