<?php
  class Database {
// DB Params
public function __construct() {
        $this->db_name = $_SESSION['db_name'];
        $this->conn = null;
        
   }
  private $conn;
// DB Connect
    public function connect() {
     $this->conn = null;
      try {
if($this->conn == null){
	$this->conn = new PDO('sqlite:' . $this->db_name);
	$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
 _log('db: '.$_SESSION['db_name']. 'Connected');
}
  return $this->conn;
      } catch(PDOException $e) {
        _log("Error!: " . $e->getMessage());
        print "Error!: " . $e->getMessage() . "<br/>";

      }
    }
}

?>