map_config.ini.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. if (!defined('IN_ONLINE')) {
  3. exit('Access Denied');
  4. }
  5. if ($_SESSION['ONLINE_USER']['is_demo'] == "t") {
  6. $_CBP_DB['host'] = '192.168.0.168';
  7. $_CBP_DB['username'] = 'root';
  8. $_CBP_DB['password'] = 'uls';
  9. $_CBP_DB['dbname'] = 'redant_to_cbp_demo';
  10. $_CBP_DB['port'] = '5432';
  11. $_CBP_DB['type'] = 'postgres';
  12. } else {
  13. $_CBP_DB['host'] = '192.168.8.82';
  14. $_CBP_DB['username'] = 'ksmap';
  15. $_CBP_DB['password'] = 'A876ctG$Fex!!';
  16. $_CBP_DB['dbname'] = 'redant_online';
  17. $_CBP_DB['port'] = '5437';
  18. $_CBP_DB['type'] = 'postgres';
  19. // $_CBP_DB['host'] = '192.168.0.121';
  20. // $_CBP_DB['username'] = 'root';
  21. // $_CBP_DB['password'] = '123456';
  22. // $_CBP_DB['dbname'] = 'online_t_1125';
  23. // $_CBP_DB['port'] = '5434';
  24. // $_CBP_DB['type'] = 'postgres';
  25. }
  26. $mapdb_url = "host=" . $_CBP_DB['host'] . " port=" . $_CBP_DB['port'] . " dbname=" . $_CBP_DB['dbname'] . " user=" . $_CBP_DB['username'] . " password=" . $_CBP_DB['password'];
  27. $mapdb = NewADOConnection($_CBP_DB['type']);
  28. $mapdb->Connect($mapdb_url) or die('Connect Database Error');
  29. $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
  30. //$mapdb->Execute("set client_encoding to 'gbk'");
  31. //打開詳細頁面時指定模式
  32. if (!empty($_REQUEST['_schemas'])) {
  33. $mapdb->Execute("SET search_path TO " . $_REQUEST['_schemas'] . ";");
  34. } elseif (!empty($_REQUEST['__schemas'])) {//部分report
  35. $mapdb->Execute("SET search_path TO " . $_REQUEST['__schemas'] . ";");
  36. } else {
  37. //超级管理员有没有选择数据库模式
  38. if (!empty($_SESSION['_current_schemas'])) {
  39. $mapdb->Execute("SET search_path TO " . $_SESSION['_current_schemas'] . ";");
  40. } else {
  41. if (empty($_SESSION['ONLINE_USER']['main_schemas'])) {
  42. $mapdb->Execute("SET search_path TO public;");
  43. } else {
  44. $mapdb->Execute("SET search_path TO " . $_SESSION['ONLINE_USER']['main_schemas'] . ";");
  45. }
  46. }
  47. }
  48. ?>