<?php
	/**
		* OPTIME Consulting, Inc.
		*
		* Description: Valida si la persona paso por el login antes de entrar en cualquier pagina
		*
		* @author Javier Mijares
		* @version 1.0  2010/10/21
	*/
	if(!is_object($objaccess)){
		$objaccess = new access($CORE_session);
	}
	if($objaccess->isnot_logged()){
		
		/*if(isset($_COOKIE[COOKIE_USER_ID])){
			$objaccess->reconect_by_cookie($_COOKIE[COOKIE_USER_ID]);
			exit;			
		}*/
		
		if (isset($_COOKIE[COOKIE_USERFULLNAME])) {
			//header("location: ".DOMAIN_APP_ROOT."lockscreen.php");
			header("location: ".DOMAIN_ROOT."login.php");
			}else{
			header("location: ".DOMAIN_ROOT."login.php");  
		}
		
		exit;
		}else if($required['profile_check']=='1'){
		$user_info = $CORE_session->read('s_user_information');
		if (!in_array($user_info['s_profile_id'], $required['valid_profiles']))   {
			$CORE_session->write('msg',array('type'=>'error','text'=>'Ud no tiene privilegios para entrar en ese modulo.'));
			//if($_varURL != 'dashboard.php'){
			header("location: ".DOMAIN_ROOT."index.php");
			//}else{
			//header("location: ".DOMAIN_BO_ROOT."login.php"); 
			//}
			exit;
		}
		}else{
		//header("location: ".DOMAIN_BO_ROOT."index.php"); 
	}
	/*if(MANTEINANCE && $CORE_session->read('s_pgen') == ''){
		header("location: ".DOMAIN_ROOT."site_maintenance.php");
		exit;
	}*/
?>