<?php
session_start();
ob_start();
error_reporting(0);
date_default_timezone_set('Asia/Kolkata');
// used to get mysql database connection
class DatabaseService{

    private $db_host;
    private $db_name;
    private $db_user;
    private $db_password;
    
   /* private $db_host = "localhost";
    private $db_name = "equipment_portal";
    private $db_user = "root";
    private $db_password = "";*/
    private $connection;

    public function getConnection(){

        if($_SERVER['HTTP_HOST']=="localhost")
        {
            $this->db_host = "localhost";
            $this->db_name = "ethics-prosperity";
            $this->db_user = "root";
            $this->db_password = "";
        }
        else
        {
            $this->db_host = "localhost";
            $this->db_name = "ethicdkm_live_prosperity";
            $this->db_user = "ethicdkm_live_prosperit";
            $this->db_password = "Prosperity@2021";
        }
        $this->connection = null;

        // Create connection
        $this->connection = mysqli_connect($this->db_host, $this->db_user, $this->db_password, $this->db_name);

        // Check connection
        if (!$this->connection) {
          die("Connection failed: " . mysqli_connect_error());
        }

        return $this->connection;
    }
}
?>