<?php
session_start();
require_once('includes/routencrypt.php');
require_once('includes/language.php');
$lang1=new language();
$nameapp="Control Bank";
$lang1->init($_SESSION['language']);
$url_admin=($ambiente_systems == "S") ? "/" : "/bancos/";
$perfil_usuario=$_SESSION['bn_perfil'];
$_SESSION['ruta_img']='../dist/';
$decryp=new routehelper();
$star=session_status() == PHP_SESSION_ACTIVE ? true : false;
$userapp=$_SESSION['bn_name_system_global'];
/**
* Valida permiso de modulo.
*/
$page_v=(empty($page))?'':$page;
$validacion_module=$decryp->validacion_module($perfil_usuario,$page);

if (isset($_SESSION['bn_name_system_global']) && $star ) {
if (!empty($page) && $validacion_module) {
	if ($page == "usuarios") {
		$view='users_view.php';
		$js='users_js.php';
		$_SESSION['active']=$url_admin.'usuarios/';
        $nameapp="Usuarios";
	}elseif ($page == "bancos") {
		$view='banks_view.php';
		$js='banks_js.php';
		$_SESSION['active']=$url_admin.'bancos/';
        $nameapp="Bancos";
	}elseif ($page == "cuentas") {
		$view='bank_accounts_view.php';
		$js='bank_accounts_js.php';
		$_SESSION['active']=$url_admin.'cuentas/';
        $nameapp="Cuentas de Banco";
	}elseif ($page == "pagos_sistema") {
		$view='system_payments_view.php';
		$js='system_payments_js.php';
		$_SESSION['active']=$url_admin.'pagos_sistema/';
        $nameapp="Pagos en Sistema";
	}elseif ($page == "transacciones") {
		$view='bank_transactions_view.php';
		$js='bank_transactions_js.php';
		$_SESSION['active']=$url_admin.'transacciones/';
        $nameapp="Transacciones";
	}elseif ($page == "transacciones_eliminadas") {
		$view='bank_transactions_delete_view.php';
		$js='bank_transactions_delete_js.php';
		$_SESSION['active']=$url_admin.'transacciones_eliminadas/';
        $nameapp="Transacciones eliminadas";
	}elseif ($page == "reportes") {
		$view='reports_view.php';
		$js='reports_js.php';
		$_SESSION['active']=$url_admin.'reportes/';
        $nameapp="Reportes";
	}elseif ($page == "reporte_transacciones") {
		$view='report_transactions_view.php';
		$js='report_transactions_js.php';
		$_SESSION['active']=$url_admin.'reporte_transacciones/';
        $nameapp="Reporte de Transacciones";
	}else{
		$view='home_view.php';
		$js='home_js.php';
		$_SESSION['active']=$url_admin.'home/';
        $nameapp="Home";
	}
    }else{
		$view='home_view.php';
		$js='home_js.php';
		$_SESSION['active']=$url_admin.'home/';
        $nameapp="Home";
	}
}else{
session_unset();
session_destroy();
header('Location: '.$url_admin.'login/');
exit;
}
?>
