<?php
require_once __DIR__ . '/../includes/audit.php';

class Database {
    private $host = "127.0.0.1";
    private $database_name = "bdr14c5_wsm";
    private $username = "bdr14c5_wsm";
    private $password = 'wsm$5p@Sy$AwC$Q';

    public $conn;

    public function getConnection(){
        $this->conn = null;
        try{
            $this->conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->database_name, $this->username, $this->password);
            $this->conn->exec("set names utf8");
            audit_set_pdo_context($this->conn);
        }catch(PDOException $exception){
            echo "Database could not be connected: " . $exception->getMessage();
        }
        return $this->conn;
    }
}  
?>
