Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <?php
  2. class connection {
  3. private $database;
  4. private $host;
  5. private $port;
  6. private $user;
  7. private $pass;
  8. public $db;
  9. public function __construct(){
  10. $this->user='postgres';
  11. $this->pass='secret';
  12. $this->host='localhost';
  13. $this->database='form';
  14. $this->port=5432;
  15. $this->db=new PDO("pgsql:host=".$this->host.
  16. ";port=".$this->port.
  17. ";dbname=".$this->database
  18. ,"'".$this->user."'"
  19. ,"'".$this->pass."'");
  20. $this->db->exec("SET CHARACTER SET utf8");
  21. return $this->db;
  22. }
  23. public function __clone(){
  24. trigger_error('The clone is not allowed', E_USER_ERROR);
  25. }
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement