| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- if (!defined('IN_ONLINE')) {
- exit('Access Denied');
- }
- if ($_SESSION['ONLINE_USER']['is_demo'] == "t") {
- $_CBP_DB['host'] = '192.168.0.168';
- $_CBP_DB['username'] = 'root';
- $_CBP_DB['password'] = 'uls';
- $_CBP_DB['dbname'] = 'redant_to_cbp_demo';
- $_CBP_DB['port'] = '5432';
- $_CBP_DB['type'] = 'postgres';
- } else {
- $_CBP_DB['host'] = '192.168.0.177';
- $_CBP_DB['username'] = 'root';
- $_CBP_DB['password'] = '123456';
- //$_CBP_DB['dbname'] = 'redant_to_cbp';
- $_CBP_DB['dbname'] = 'usai_to_cbp_033021';
- $_CBP_DB['port'] = '5433';
- $_CBP_DB['type'] = 'postgres';
- }
- $cbpdb_url = "host=" . $_CBP_DB['host'] . " port=" . $_CBP_DB['port'] . " dbname=" . $_CBP_DB['dbname'] . " user=" . $_CBP_DB['username'] . " password=" . $_CBP_DB['password'];
- $cbpdb = NewADOConnection($_CBP_DB['type']);
- $cbpdb->Connect($cbpdb_url) or die('Connect Database Error');
- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
- //$cbpdb->Execute("set client_encoding to 'gbk'");
- //打開詳細頁面時指定模式
- if (!empty($_REQUEST['_schemas'])) {
- $cbpdb->Execute("SET search_path TO " . $_REQUEST['_schemas'] . ";");
- } elseif (!empty($_REQUEST['__schemas'])) {//部分report
- $cbpdb->Execute("SET search_path TO " . $_REQUEST['__schemas'] . ";");
- } else {
- //超级管理员有没有选择数据库模式
- if (!empty($_SESSION['_current_schemas'])) {
- $cbpdb->Execute("SET search_path TO " . $_SESSION['_current_schemas'] . ";");
- } else {
- if (empty($_SESSION['ONLINE_USER']['main_schemas'])) {
- $cbpdb->Execute("SET search_path TO public;");
- } else {
- $cbpdb->Execute("SET search_path TO " . $_SESSION['ONLINE_USER']['main_schemas'] . ";");
- }
- }
- }
- ?>
|