Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

326
Views
Redirección de usuario desactivada para iniciar sesión desde la solicitud ajax

¿Alguien puede decirme la mejor práctica para verificar si el usuario está activado e iniciado sesión? ¿Y cómo puedo manejarlo desde la solicitud de ajax?

Si un usuario está desactivado, redirija a la página de inicio de sesión a través de una solicitud ajax en un controlador.

Estoy creando una función auxiliar y llamándola en el constructor.

Pero no redirige al inicio de sesión si el usuario está desactivado y devuelve "Código de estado: 303 Ver otro"

En el controlador:

 function __construct() { parent::__construct(); $this->load->helper('auth_helper'); if (!auth()) { redirect('login/login_panel'); } }

Función auxiliar:

 function auth() { $CI =& get_instance(); $user = true; if ($CI->session->userdata('user_id')) { $CI->load->model('users_model'); $active = $CI->users_model->getActive($CI->session->userdata('user_id')); if ($active->active == '0' || $active->active == null) { $user = false; } } else { $user = false; } return $user; }
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

prueba esto

 function __construct() { parent::__construct(); $this->load->helper('auth_helper'); if (!auth()) { header('Location: login/login_panel'); exit(); } }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!