<?php
class Database {
public $host;
public $dbname;
public $username;
public $password;
public $db;
public function __construct() {
$host = $this->host = "...";
$dbname = $this->dbname = "...";
$username = $this->username = "...";
$password = $this->password = "...";
try{
$this->db = new PDO ("mysql:host=$host;dbname=$dbname", $username, $password);
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->db->query('SET NAMES "utf8"');
}
catch (PDOException $e) {
$e->getMessage();
}
}
}
PD9waHAKY2xhc3MgRGF0YWJhc2UgewoJcHVibGljICRob3N0OwoJcHVibGljICRkYm5hbWU7CglwdWJsaWMgJHVzZXJuYW1lOwoJcHVibGljICRwYXNzd29yZDsKCXB1YmxpYyAkZGI7CglwdWJsaWMgZnVuY3Rpb24gX19jb25zdHJ1Y3QoKSB7CgkJJGhvc3QgPSAkdGhpcy0+aG9zdCA9ICIuLi4iOwoJCSRkYm5hbWUgPSAkdGhpcy0+ZGJuYW1lID0gIi4uLiI7CgkJJHVzZXJuYW1lID0gJHRoaXMtPnVzZXJuYW1lID0gIi4uLiI7CgkJJHBhc3N3b3JkID0gJHRoaXMtPnBhc3N3b3JkID0gIi4uLiI7CgkJdHJ5ewoJCSR0aGlzLT5kYiA9IG5ldyBQRE8gKCJteXNxbDpob3N0PSRob3N0O2RibmFtZT0kZGJuYW1lIiwgJHVzZXJuYW1lLCAkcGFzc3dvcmQpOwoJCSR0aGlzLT5kYi0+c2V0QXR0cmlidXRlKFBETzo6QVRUUl9FUlJNT0RFLCBQRE86OkVSUk1PREVfRVhDRVBUSU9OKTsKCQkkdGhpcy0+ZGItPnF1ZXJ5KCdTRVQgTkFNRVMgInV0ZjgiJyk7CgkJfQoJIAljYXRjaCAoUERPRXhjZXB0aW9uICRlKSB7CgkJCSRlLT5nZXRNZXNzYWdlKCk7CgkJfQoJfQp9