Welcome Guest, Not a member yet? Register   Sign In
Redirect confusion
#1

HI there.

I am somewhat confused as to how to move from one controller to another. It would appear that the only way to do it is to use a redirect call like this - this is inside a controller....

Code:
class Welcome extends CI_Controller {

function __construct()
{

parent::__construct();

$this->load->library('ion_auth');
}

public function index()
{

if (!$this->ion_auth->logged_in())
{
redirect('auth/login', 'refresh');
}

$this->load->view('welcome_message');
}

Is this correct? As I understand it, this switches program flow from the Welcome Controller to the login method on the Auth controller. And inside the Auth controller, I could do something like :

Code:
if (!$this->ion_auth->logged_in())
{
// redirect them to the login page
redirect('auth/login', 'refresh');
}
else
{
redirect('welcome/index', 'refresh');
}

JMB
Reply


Messages In This Thread
Redirect confusion - by MightBeABitLate - 08-09-2018, 04:06 PM
RE: Redirect confusion - by php_rocs - 08-09-2018, 07:38 PM
RE: Redirect confusion - by MightBeABitLate - 08-09-2018, 10:53 PM
RE: Redirect confusion - by Pertti - 08-10-2018, 01:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB