Guest User

Untitled

a guest
Jan 27th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. public function connect()
  2. {
  3. return "abc";
  4. }
  5.  
  6. Internal Server Error
  7. The server encountered an internal error or misconfiguration and was unable to complete your request.
  8.  
  9. Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
  10.  
  11. More information about this error may be available in the server error log.
  12.  
  13. Apache/2.4.18 (Ubuntu)
  14.  
  15. [Sat Jan 27 08:27:50.831563 2018] [fcgid:warn] [pid 21420] [client 138.68.73.42:53972] mod_fcgid: read data timeout in 41 seconds
  16. [Sat Jan 27 08:27:50.834028 2018] [core:error] [pid 21420] [client 138.68.73.42:53972] End of script output before headers: user.php
  17.  
  18. class Database
  19. {
  20.  
  21. private $dsn = "";
  22. private $username = "";
  23. private $password = "";
  24. public $conn = null;
  25.  
  26. public function getConn()
  27. {
  28. return $this->conn;
  29. }
  30.  
  31. public function setConn($conn)
  32. {
  33. $this->conn = $conn;
  34. }
  35.  
  36. function __construct($dsn = "", $username = "", $password = "")
  37. {
  38. $this->dsn = $dsn;
  39. $this->username = $username;
  40. $this->password = $password;
  41. }
  42. public function connect()
  43. {
  44. try {
  45. $a = new PDO($this->getDsn(), $this->getUsername(), $this->getPassword());
  46. $a->exec("set names utf8");
  47. } catch (PDOException $exception) {
  48. echo "Connection error: " . $exception->getMessage();
  49. }
  50.  
  51. return $a;
  52. }
  53. }
  54.  
  55. <?php
  56.  
  57. require_once 'database.php';
  58. require_once '../../config/settings.php';
  59.  
  60. // all variables is sets. I controlled thems.
  61. // dsn, user and pass variables coming from '../../config/settings.php'
  62. $db = new database($dsn, $user, $pass);
  63. $db = $db->connect();
  64.  
  65. <?php
  66. require_once 'header.php';
Add Comment
Please, Sign In to add comment