<?php

class Auth extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->load->model('Auth_model');
        $this->load->helper('url_helper');
    }

    public function index() {
        $data['title'] = 'CVS --> Mercado Libre';
        $this->load->view('templates/header', $data);
        $this->load->view('auth/mercadolibre', $data);
        $this->load->view('templates/footer');
    }
    
    public function autorize(){
        $data['title'] = 'CVS --> Mercado Libre';
        $data['auth'] = $this->Auth_model->get_autorize();
        $this->load->model('Users_model');
        $data['user'] =  $this->Users_model->get_me($data['auth']);        
        $this->Users_model->insert_entry($data['auth'],$data['user']);        
        
        $this->load->view('templates/header', $data);
        $this->load->view('dashboard/main', $data);
        $this->load->view('uploadform/upload_form', $data);
        $this->load->view('templates/footer');
    }

}
