[eluser]slowgary[/eluser]
Hi all,
I'm tinkering with a basic auth system (I know there are some good ones out there already, but this is just for fun).
My approach is very basic, but for some reason it's not working. Here's my pseudocode:
Code:
class SecureController extends Controller
{
function SecureController()
{
parent::Controller();
// is_logged_in() returns true/false depending
if(! $this->is_logged_in()) {
$this->load->view('login');
die();
}
}
}
class Admin extends SecureController
{
function index()
{
echo 'admin controller';
}
}
The problem is that the 'login' view is never shown. I know output is buffered in CodeIgniter, so I'm guessing that die() stops the output from being sent to the browser. If I omit die(), however, then 'admin controller' is displayed followed by the contents of the login view.
Is it possible to stop code execution after displaying a view?
Thanks for reading.