CodeIgniter Forums
[SOLVED] Help required - User logged in can see admin - 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: [SOLVED] Help required - User logged in can see admin (/showthread.php?tid=48057)



[SOLVED] Help required - User logged in can see admin - El Forum - 01-03-2012

[eluser]the_unforgiven[/eluser]
Hi all,

I'm building an application but when a user is logged in they can still navigate to url.com/admin and access the admin side of things what can I do to stop this?

What is the best way?

Currently am just using the session data.
----------------------------------------------------
SOLVED BY DOING THIS:
Code:
function home()
{
  if ($this->session->userdata('group_id') == '1') { // THIS LINE WORKS
  $data['ptitle'] = "Dashboard";
  $data['heading'] = "Welcome";
  $this->load->view('admin/home', $data);
  }else { redirect('admin/restricted'); }
}