<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Principal extends CI_Controller {

	public function __construct(){

        parent::__construct();

		if ($this->session->id_usuario == ''){
			$usuario = $this->input->get('usuario');
			$senha = $this->input->get('senha');

			if ($usuario != ''){
				$this->load->model('login_model');
				$ret = $this->login_model->loga($usuario,$senha);

				if (count($ret) == 0){
					redirect('login','refresh');
				}

				$this->session->id_usuario = $ret[0]->idusuario;
			}else{
				redirect('login','refresh');
			}
		}

    }




	public function index(){

	
		
		$data = '';

		$this->template->load('_template','principal', $data);
	}
}
