Welcome Guest, Not a member yet? Register   Sign In
problem whith connecting admin and main controllers
#1

[eluser]erjakrobaczek[/eluser]
Hello, I'm just started to learn CI and have found problem, which I have no idea what to do. I suppose it is very easy, but I don't feel good in CI now and it took me a lot of time.

The problem is:
I have a main controller in which I have my start page with news etc, also have an admin controller, where I can login to admin panel and manage the page.
When I'm using /admin path in right menu I have login form or info that I'm login, it's great. But when I'm going back to main page, so I'm using main controller there is a problem - I don't know how to use in these case function to check login from admin controller in it. I have tried to copy the function, but I'm sure that it's very stupid idea. How should I defend it?
#2

[eluser]sophistry[/eluser]
you can sub-class the controllers main and admin to a shared login controller and put your login check in the constructor of the login controller.

also, login checks can be done using CI hooks. search on login hook in the forum or the wiki.
#3

[eluser]erjakrobaczek[/eluser]
Ok, it have taken me all the day to try a lot of difrent auth options. Now I found Userlib and it seems to work whith me Wink Thanks to Xikeon :-)




Theme © iAndrew 2016 - Forum software by © MyBB