@giovanny.lueilwitz
To prevent a user from going back to the login page after they have already logged in, you can implement a redirect in the login controller. Here's how you can do it in CodeIgniter:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
public function login() { // Check if user is already logged in if ($this->session->logged_in) { redirect('dashboard'); // Redirect to dashboard or any other page } // Process login logic here // If login is successful, set session variable $this->session->set_userdata('logged_in', true); // Redirect to dashboard after successful login redirect('dashboard'); } |
1 2 3 4 |
public function __construct() { parent::__construct(); $this->load->library('session'); } |
By implementing this redirect logic in your login controller, the user will be redirected to a different page if they try to access the login page after they have already logged in.