Welcome Guest, Not a member yet? Register   Sign In
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



Theme © iAndrew 2016 - Forum software by © MyBB