| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?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.8.82';
- $_CBP_DB['username'] = 'ksmap';
- $_CBP_DB['password'] = 'A876ctG$Fex!!';
- $_CBP_DB['dbname'] = 'redant_online';
- $_CBP_DB['port'] = '5437';
- $_CBP_DB['type'] = 'postgres';
- // $_CBP_DB['host'] = '192.168.0.121';
- // $_CBP_DB['username'] = 'root';
- // $_CBP_DB['password'] = '123456';
- // $_CBP_DB['dbname'] = 'online_t_1125';
- // $_CBP_DB['port'] = '5434';
- // $_CBP_DB['type'] = 'postgres';
- }
- $mapdb_url = "host=" . $_CBP_DB['host'] . " port=" . $_CBP_DB['port'] . " dbname=" . $_CBP_DB['dbname'] . " user=" . $_CBP_DB['username'] . " password=" . $_CBP_DB['password'];
- $mapdb = NewADOConnection($_CBP_DB['type']);
- $mapdb->Connect($mapdb_url) or die('Connect Database Error');
- $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
- //$mapdb->Execute("set client_encoding to 'gbk'");
- //打開詳細頁面時指定模式
- if (!empty($_REQUEST['_schemas'])) {
- $mapdb->Execute("SET search_path TO " . $_REQUEST['_schemas'] . ";");
- } elseif (!empty($_REQUEST['__schemas'])) {//部分report
- $mapdb->Execute("SET search_path TO " . $_REQUEST['__schemas'] . ";");
- } else {
- //超级管理员有没有选择数据库模式
- if (!empty($_SESSION['_current_schemas'])) {
- $mapdb->Execute("SET search_path TO " . $_SESSION['_current_schemas'] . ";");
- } else {
- if (empty($_SESSION['ONLINE_USER']['main_schemas'])) {
- $mapdb->Execute("SET search_path TO public;");
- } else {
- $mapdb->Execute("SET search_path TO " . $_SESSION['ONLINE_USER']['main_schemas'] . ";");
- }
- }
- }
- ?>
|