Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.80 KB | None | 0 0
  1. #
  2. <?php
  3. #
  4.  
  5. #
  6. $DB_DSN="pgsql:dbname=cluebringer;host=server1.hostname.com";
  7. #
  8. $DB_USER="ore";
  9. #
  10. $DB_PASS="password";
  11. #
  12.  
  13. #
  14. ?>
  15. #
  16.  
  17. #
  18.  
  19. #
  20.  
  21. #
  22.  
  23. #
  24.  
  25. #
  26. cat db.php
  27. #
  28. <?php
  29. #
  30.  
  31. #
  32. require_once('includes/config.php');
  33. #
  34.  
  35. #
  36.  
  37. #
  38. function connect_db()
  39. #
  40. {
  41. #
  42.        global $DB_DSN;
  43. #
  44.        global $DB_USER;
  45. #
  46.        global $DB_PASS;
  47. #
  48.  
  49. #
  50.        try {
  51. #
  52.                $dbh = new PDO($DB_DSN, $DB_USER, $DB_PASS, array(
  53. #
  54.                        PDO::ATTR_PERSISTENT => false
  55. #
  56.                ));
  57. #
  58.  
  59. #
  60.                $dbh->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
  61. #
  62.  
  63. #
  64.        } catch (PDOException $e) {
  65. #
  66.                die("Error connecting to Policyd v2 DB: " . $e->getMessage());
  67. #
  68.        }
  69. #
  70.  
  71. #
  72.        return $dbh;
  73. #
  74. }
  75. #
  76.  
  77. #
  78. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement