CodeIgniter Forums
Loading externa/internal views correctly - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Loading externa/internal views correctly (/showthread.php?tid=47898)



Loading externa/internal views correctly - El Forum - 12-27-2011

[eluser]codeboy[/eluser]
Hey All,
I load an external (landing page) or an internal page (after someone logs in) depending on the session variable (logged_in) that I set when someone logs in. I find that this breaks when

1. I login
2. Close the browser
3. Open the browser and I hit the same URL again

Instead of getting the external landing page, I get internal page with the content of the external page (and does not look pretty!). It looks like my session was not destroyed completely when I closed the browser.

I also check to see if the session is valid (sess_read) but that does not seem to work either.

Code:
#Always check if the session is valid
  if (($this->session->sess_read()) && ($this->session->userdata('logged_in') == true)) {
    $this->load->view('master_view_ext_logged_in', $data);
  } else {
    $this->load->view('master_view_ext', $data);
  }

Any pointers are appreciated.

Thanks!