Welcome Guest, Not a member yet? Register   Sign In
not all controllers can red the cookie Why???????????
#1

[eluser]ahmedbloger[/eluser]
hi,every one
i have ea strange problem i have done 80% from my application and i am now want way to check if the user is logged or not and if he logged i want to know his id
so i try to use the cookies and the login function found in controller which i called site
know my problem is that the site controller is only which read the thee cookies,how i can make all controllers read it???????
please help me.
#2

[eluser]Zeeshan Rasool[/eluser]
if you have this function in controller then you can access it only from that controller.Try to put it in any model, then you will be able to get it in all controllers.
#3

[eluser]Wuushu[/eluser]
I would turn any session/cookie auth-logic into a library and autoload it, that way I can access it from anywhere within my application by doing something like:

if($user_id = $this->auth->is_logged_in()) (returns user_id OR FALSE)
{
}
else
{
}
#4

[eluser]ahmedbloger[/eluser]
thank every body but i will explain my problem more
now my default controller is 'site' and it have the llogin funcvtion the problem is that if i go to thrpath
localhost/project/ ->the ci cant read the cookies in this domain
now if i go to the address localhost/project/site/
the ci now read the cookies
so i think the problem is at the cookies domain.
#5

[eluser]Wuushu[/eluser]
Then set the cookie domain to '/'.
#6

[eluser]ahmedbloger[/eluser]
i will try it then toll you
thank you




Theme © iAndrew 2016 - Forum software by © MyBB