<?php
//include("JSON.php");

class DBController {
	private $conn = "";
	private $host = "66.70.255.14";
	private $user = "netempire_elsycb";
	private $password = "Tm3Y@1CtWn67";
	private $database = "netempire_elsy";
	//private $host = "localhost";
	//private $user = "em-empire";
	//private $password = "188919391945";
	//private $database = "mcm";
	function __construct() {
		$conn = $this->connectDB();
		if(!empty($conn)) {
			$this->conn = $conn;			
		}
	}
	function connectDB() {
		$conn = mysqli_connect($this->host,$this->user,$this->password,$this->database);
		$conn-> set_charset("utf8");
		return $conn;
	}
	function executeSelectQuery($query) {
		$result = mysqli_query($this->conn,$query);
		while($row=mysqli_fetch_assoc($result)) {
			$resultset[] = $row;
		}
		if(!empty($resultset))
			return $resultset;
	}
	function executeInsertQuery($query) {
		echo $query;
		if (mysqli_query($this->conn,$query)) {
      		return "ok";
		} else {
      		return "Error: " . $query . "<br>" . mysqli_error($conn);
		}
		
	}
}

class DBCunitecnar {
	private $conn = "";
	private $host = "66.70.255.14";
	private $user = "netempire_elsycb";
	private $password = "Tm3Y@1CtWn67";
	private $database = "netempire_elsy";
	function __construct() {
		$conn = $this->connectDB();
		if(!empty($conn)) {
			$this->conn = $conn;			
		}
	}
	function connectDB() {
		$conn = mysqli_connect($this->host,$this->user,$this->password,$this->database);
		$conn-> set_charset("utf8");
		return $conn;
	}
	function executeSelectQuery($query) {
		$result = mysqli_query($this->conn,$query);
		while($row=mysqli_fetch_assoc($result)) {
			$resultset[] = $row;
		}
		if(!empty($resultset))
			return $resultset;
	}
	function executeInsertQuery($query) {
		echo $query;
		if (mysqli_query($this->conn,$query)) {
      		return "ok";
		} else {
      		return "Error: " . $query . "<br>" . mysqli_error($conn);
		}
		
	}
}

class DBCdnd {
	private $conn = "";
	private $host = "66.70.255.14";
	private $user = "netempire_elsycb";
	private $password = "Tm3Y@1CtWn67";
	private $database = "netempire_elsy";
	function __construct() {
		$conn = $this->connectDB();
		if(!empty($conn)) {
			$this->conn = $conn;			
		}
	}
	function connectDB() {
		$conn = mysqli_connect($this->host,$this->user,$this->password,$this->database);
		$conn-> set_charset("utf8");
		return $conn;
	}
	function executeSelectQuery($query) {
		$result = mysqli_query($this->conn,$query);
		while($row=mysqli_fetch_assoc($result)) {
			$resultset[] = $row;
		}
		if(!empty($resultset))
			return $resultset;
	}
	function executeInsertQuery($query) {
		echo $query;
		if (mysqli_query($this->conn,$query)) {
      		return "ok";
		} else {
      		return "Error: " . $query . "<br>" . mysqli_error($conn);
		}
		
	}
}



?>