<?php

if(!defined("SPECIALCONSTANT")) die("Acceso Denegado");

function getConnection(){

    try {

        $ini = parse_ini_file('app/config/SIGECRE.INI');
        
        $db_username = "sigecre";
        $db_password = "cochi01";
        $db_host = $ini['ServidorSql'];
        $db_base = $ini['BaseSql'];
        
        $db_connection = '';
        $db_connection = $db_connection.'mysql:host='.$db_host;
        $db_connection = $db_connection.';dbname='.$db_base;
        
        $connection = new PDO( $db_connection, $db_username, $db_password );
            
        $connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        
    } catch (PDOException $ex) {
        echo 'Error de Conexion PDO:'.$ex->getMessage();
    }
    return $connection;
    
}