<!-- Realisatsiooni aluseks on võetud:
Login Registration with Email Verification, Forgot Password using PHP
Kasutatud 6.04.2016
http://www.codingcage.com/2015/09/login-registration-email-verification-forgot-password-php.html
-->

<?php
class Database
{
     
    private $host = "localhost";
    private $db_name = "oksjoniportaal";
    private $username = "root";
    private $password = "root";
    public $conn;
     
    // Andmebaasi ühenduse loomine
    public function dbConnection()
	{
     
	    $this->conn = null;    
        try
		{
            $this->conn = new PDO("mysql:host=" . $this->host . ";dbname=" . $this->db_name, $this->username, $this->password);
			$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);	
        }
		catch(PDOException $exception)
		{
            echo "Connection error: " . $exception->getMessage();
        }
         
        return $this->conn;
    }
}
?>