• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Needed: Summary of Security and Sessions versus standard PHP

#2
[eluser]Lick[/eluser]
LoginPage:
Code:
class MyLoginPage extends Controller {

   function MyLoginPage () {
      parent::Controller();

      $this->load->library('session'); // use this or Auto-Load

      if ( /* valid user login */ ) {
          $this->session->set_userdata('logged_in', TRUE);
      }
   }
  
   ...
}

SecretPages:
Code:
class MySecretPage extends Controller {

   function MySecretPage() {
      parent::Controller();

      $this->load->library('session'); // use this or Auto-Load

      if ($this->session->userdata('logged_in') !== TRUE) {
          redirect(site_url());
      }
   }
  
   ...
}

I'm pretty new to CodeIgniter so this might totally not work, at all.


Messages In This Thread
Needed: Summary of Security and Sessions versus standard PHP - by El Forum - 07-05-2007, 09:40 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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