Welcome Guest, Not a member yet? Register   Sign In
Problem with user authentication
#1

[eluser]marcin_koss[/eluser]
I have a problem creating authentication part for my application.

Below is the simplified version of my controllers.

The idea is that the MY_controller checks if session with user data exists.
If it doesn't, then redirects to the index page where you have to log in.

MY_controller.php

Code:
class MY_Controller extends Controller {
    
function __construct()
{
parent::__construct();
        
$this->load->helper('url');
$this->load->library('session');
        
if($this->session->userdata('user') == FALSE) {
redirect('index');

} else {
redirect('search');
}

}

}

order.php - main controller

Code:
class Orders extends MY_Controller {

function __construct()
{
parent::__construct();
        
$this->load->helper('url');
$this->load->library('session');
}

function index()
{
// Here would be the code that validates information input by user.
// If validation is successful, it creates the user session.


$this->load->view('header.html', $data); // load header
$this->load->view('index_view', $data); // load body
$this->load->view('footer.html', $data); // load footer
}

function search()
{
//different page
}

what is happening is that the browser is telling me that "The page isn't redirecting properly. Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

Does that mean that the redirect is in a loop?

I also came across this article where authentication is handled pretty much the same way
http://davidwinter.me.uk/articles/2009/0...deigniter/


Messages In This Thread
Problem with user authentication - by El Forum - 05-19-2010, 08:37 PM
Problem with user authentication - by El Forum - 05-19-2010, 08:55 PM
Problem with user authentication - by El Forum - 05-19-2010, 09:02 PM
Problem with user authentication - by El Forum - 05-19-2010, 09:07 PM
Problem with user authentication - by El Forum - 05-20-2010, 03:14 PM
Problem with user authentication - by El Forum - 05-20-2010, 04:50 PM
Problem with user authentication - by El Forum - 05-21-2010, 07:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB