public function index()
 {
     if (Session::get('logined')) {
         $user_id = Session::get('user_id');
         $model = new Session_Model();
         $model->delete("user_id = '{$user_id}'");
         Session::destroy();
     }
 }
 /**
  * 
  */
 public function procesar()
 {
     $params = $this->input->post(null, true);
     $usuario = $this->_usuario_model->getByUserAndPass($params["username"], $params["password"]);
     if (!is_null($usuario)) {
         $this->_session_model->autentificar($usuario->usu_c_rut);
         if ($usuario->bo_cambiar_password == 1) {
             redirect(base_url("login/actualizar"));
         } else {
             $this->_redireccion();
         }
     }
     $this->load->view('pages/login/index', array("error" => true, "mensaje" => "El usuario no es válido, intente nuevamente."));
 }
 /**
  * Check if user is login to system
  * @param  [type]  $user_id  [description]
  * @param  [type]  $id_token [description]
  * @return boolean           [description]
  */
 function isValidUser($user_id, $id_token)
 {
     $model = new Session_Model();
     $result = $model->selectWhere('*', "user_id = " . "'{$user_id}'");
     if (!isset($result)) {
         return false;
     }
     if ($result[0]['id_token'] == $id_token) {
         if ($result[0]['date_created'] + 3600 > time()) {
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Exemple #4
0
 public function __construct(Template_Lib $templat = null)
 {
     $templat && ($this->template = $templat);
     // process query_string FIRST as mapped routes may need it
     $this->process_query_string();
     // on landing, set organisation and save visit info
     if (!isset($_SESSION['org_id'])) {
         $ses = new Session_Model($this->template, $this->query_string);
         $ses->save_session_info();
         $ses->get_organisation();
     }
     $this->load_routes();
     //$this->process_uri();
     $this->format = $this->get_format();
     // set template's referer_url if one is available
     isset($_SERVER['HTTP_REFERER']) && $this->template && ($this->template->referer_url = $_SERVER['HTTP_REFERER']);
     // set current domain / host (ie from the url that someone typed in)
     isset($_SERVER['SERVER_NAME']) && $this->template && ($this->template->host = $_SERVER['SERVER_NAME']);
     /*
       $debug = new Debug_lib();
       $debug->print_hash($_SERVER);
     
       echo "<p>PHP INPUT<br />";
       print_r (file_get_contents('php://input'));
     
       echo "<p>POST info<br />";
       $debug->print_hash($_POST);
     
       echo "<p>Check boxes ?<br />";
       //echo $_POST['check'];
       $debug->print_hash($_POST['check']);
     
       echo "<p>Print from $ variables ?<br />";
       echo "check: " . $check;
     */
 }
Exemple #5
0
 public function updatepassword()
 {
     $s = new Session_Model($this->template, $this->router->query_string);
     $s->update_password();
     $this->template->render("update_password_result", "json");
 }