<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@page import="conexion.*" import="java.sql.*" import="general.Config" import="general.Permisos" import="java.util.Hashtable" %> Bienvenido <% /********************************* Pagina de bienvenida al sistema, por ahora vacia ****************************************************/ /***************************************************************************************************/ out.println(""); String nompag[] = request.getRequestURI().split("/"); %> <% Conexion c=null; Connection lcnt_con=null; ResultSet lrs_res=null; Statement lst_stm=null; String ls_query = new String(""); String emergent_error = new String(""); boolean lb_connection = false; String debug = new String("si"); int num_dashboards = 0; String first_dashboard = new String(""); String script_nombre_dash_menu = new String(""); // Conexión a la base de datos try { if (!Config.getParametro("debug").equals("si")) debug = "no"; c=new Conexion(); lcnt_con= c.getConnection(); lst_stm=lcnt_con.createStatement(); lb_connection = true; } catch (Exception e) { emergent_error="Error al conectarse a la base de datos "; // Verifica si está habilitado el modo debug if (debug.equals("si")) emergent_error+=e; lb_connection=false; } //********* Validación fundamental para evitar ejecución de código sin privilegios suficientes **********// try{ if (!Permisos.PermisoModulo(nompag[nompag.length-1].toString(), Integer.parseInt(session.getAttribute("id_user").toString()))) { if (lb_connection) { lst_stm.close(); lcnt_con.close(); } emergent_error += " Privilegios insuficientes. "; lb_connection = false; } } catch(Exception e){ emergent_error += " Privilegios insuficientes. "; if (debug.equals("si")) emergent_error+="Trace: "+e.toString(); lb_connection = false; } //*******************************************************************************************************// if (lb_connection) { try { %>
<% } else out.print(" Usuario no-existente (!)"); %>
<% ls_query = "select CONCAT(nombre_real, ' ', paterno, ' (', nombre_usuario, ')') as nombre, sexo from usuarios WHERE " + "id_usuarios="+session.getAttribute("id_user").toString()+";"; lrs_res = lst_stm.executeQuery(ls_query); if (lrs_res.next()) { %> Bienvenid<%=lrs_res.getString("sexo").equals("m")?"o":"a" %><%=" "+lrs_res.getString("nombre")%>
<% Hashtable dashboards = Permisos.dashboards(Integer.parseInt(session.getAttribute("id_user").toString()), request.getParameter("id_supermodulos")); if (dashboards != null) { Object[] lo_keyNames = dashboards.keySet().toArray(); for (int i = 0; i < dashboards.size(); i++) { if (!dashboards.get(lo_keyNames[i]).toString().equals("")) { if (num_dashboards == 0) first_dashboard = dashboards.get(lo_keyNames[i]).toString(); num_dashboards++; } } if (dashboards.keySet().size() > 1) { %>   || 
<% } catch (Exception e) { out.print(" Anónimo (Esto no debería suceder)"); if (debug.equals("si")) emergent_error+=" Error al recuperar datos de usuario. "+"Trace: "+e.toString(); out.println("
"+emergent_error+"
"); } finally { lst_stm.close(); lcnt_con.close(); } %>
_
<% } else { %>
<%=emergent_error%>
<% } %> <%=script_nombre_dash_menu %>