• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Basic authentication system

#11
[eluser]jayrulez[/eluser]
i haven't started using CI yet so i'm not sure about the syntax but my suggestion would be to use two controllers, one for the public where you can have your login method and pther methods that do not require authorisation.

have your controller that requires authorisation extend a base controller. eg

Code:
<?php

class Base extends CI_main_controller//whatever the name of CI_main_controller is
{
   public function __construct()
   {
      if(!$this->session->userdata('logged_in'))
      {
         redirect('/login/');
      }
   }
}

?>

now ur controller
Code:
<?php

class Blog extends Base
{
   public function __construct()
   {
      parent::__construct();
   }

   public function index()
   {
      $this->display();
   }
}

?>

and then your public controller
Code:
<?php

class Public extends CI_main_controller//whatever the name of CI_main_controller is
{
   public function login()
   {

   }

   public function register()
   {

   }
}

?>


Messages In This Thread
Basic authentication system - by El Forum - 06-09-2009, 01:17 PM
Basic authentication system - by El Forum - 06-09-2009, 01:33 PM
Basic authentication system - by El Forum - 06-09-2009, 01:34 PM
Basic authentication system - by El Forum - 06-10-2009, 06:40 AM
Basic authentication system - by El Forum - 06-10-2009, 08:07 AM
Basic authentication system - by El Forum - 06-10-2009, 08:11 AM
Basic authentication system - by El Forum - 06-10-2009, 08:14 AM
Basic authentication system - by El Forum - 06-10-2009, 01:01 PM
Basic authentication system - by El Forum - 06-10-2009, 01:28 PM
Basic authentication system - by El Forum - 06-10-2009, 01:35 PM
Basic authentication system - by El Forum - 06-10-2009, 01:45 PM
Basic authentication system - by El Forum - 06-10-2009, 01:49 PM
Basic authentication system - by El Forum - 06-10-2009, 01:51 PM
Basic authentication system - by El Forum - 06-10-2009, 02:42 PM
Basic authentication system - by El Forum - 06-11-2009, 01:14 PM
Basic authentication system - by El Forum - 06-11-2009, 02:47 PM
Basic authentication system - by El Forum - 06-12-2009, 02:49 AM
Basic authentication system - by El Forum - 06-14-2009, 06:37 AM
Basic authentication system - by El Forum - 06-14-2009, 10:51 AM
Basic authentication system - by El Forum - 06-14-2009, 01:45 PM
Basic authentication system - by El Forum - 06-14-2009, 03:35 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.