[eluser]learning_php[/eluser]
I am trying to create a user login and have created the following controller:
Code:
<?PHP
class gallery extends Controller {
function gallery()
{
parent::Controller();
$this->load->database();
$this->load->helper(array('url', 'form', 'date', 'cookie'));
$this->load->library(array('form_validation', 'upload', 'Erkanaauth', 'session'));
}
function index(){
$this->authorize();
$this->load->view('gallery_view');
}
function login()
{
$this->authorize();
$this->db->get('members');
$username = $this->input->post('username', true);
$password = $this->input->post('password', true);
if($username || $password)
{
if($this->erkanaauth->try_login(array('username' => $username, 'password' => $password)))
redirect('homepage');
}
$this->load->view('test_view');
}
function logout()
{
$this->erkanaauth->logout();
redirect('','Homepage');
}
private
function authorize()
{
if($this->erkanaauth->try_session_login())
return true;
redirect('gallery/login');
}
}
?>
but I get a Redirect Loop error and I am not sure why?