Where can I place my \"global\" function, which will check, if user is logged in?
Because I want to do something like: user is able to browse some pages only when th
Are you using an authentication library? If not I'd suggest one. They come with functions like that.
Tank Auth for example has: is_logged_in()
, which does exactly what you want!
http://www.konyukhov.com/soft/tank_auth/
For more info about which library to use you should check out this answer which compares all libs: https://stackoverflow.com/a/476902/576223
If you don't want an authentication library you can do as suggested by Joe