<?php
$obj = new clsMante("localhost", "root", "123456", "bebind","MYSQL");
$obj->AbrirConexion();
$cabe = $obj->PrintCabecera(array("img","grupo.png"));
echo $cabe;
class clsMante {
	private $strServidor;
	private $strUsuario;
	private $strClave;
	private $strBD;
	private $srttype;
	private $cnx;
	
	public function __construct($strServidor,$strUsuario,$strClave,$strBD,$srttype) {
		$this->strServidor 	= $strServidor;
		$this->strUsuario 	= $strUsuario;
		$this->strClave 	= $strClave;
		$this->strBD 		= $strBD;
		$this->type			= $srttype;
	 	}
	
	public function AbrirConexion() {  
		$MsjeErrorServer = "ERROR: No se Puede Conectar al Servidor: ".$this->strServidor;
		$MsjeErrorBase = "ERROR: No se puede Conectar a la Base: ".$this->strBD." en el Servidor: ".$this->strServidor;
		
		if (strtoupper($this->type)=="MYSQL") {			
			$this->cnx = mysql_connect(	$this->strServidor, $this->strUsuario, $this->strClave) 
						 or die($this->MuestraError($MsjeErrorServer."<br>".mysql_error()));			
			mysql_select_db($this->strBD,$this->cnx) or die($this->MuestraError($MsjeErrorBase."<br>".mysql_error()));		
			}
		elseif (strtoupper($this->type)=="SQL") {
			$this->cnx = mssql_connect($this->strServidor, $this->strUsuario, $this->strClave)
						 or die($this->MuestraError($MsjeErrorServer."<br>".mysql_error()));	
			mssql_select_db($this->strBD,$this->cnx) or die($this->MuestraError($MsjeErrorBase."<br>".mysql_error()));
			}
		return $this->cnx;
		}
		
	function CerrarConexion() {
		if(strtoupper($this->type)=="MYSQL") mysql_close($this->cnx);
		elseif(strtoupper($this->type)=="SQL") mssql_close($this->cnx);
		}
		
	public function MuestraError($mensaje) {
		echo $mensaje;
		}
		
	public function PrintCabecera($dato) {
		//$dato[0] = imagen, $dato[1]=titulo
		if(isset($dato)) {
			$cab .= '<center><h1><img src = "'.$dato[0].'">'.$dato[1].'</h1></center>';
			$cab .= '<hr>';
			}
		return $cab;			
		}
	public function Listar() {
		}
	}
?>