[TYPO3-dev] How can I detect a logged in fronted user?
Michael Stucki
michael at typo3.org
Wed Jun 13 00:01:13 CEST 2007
Hi Michiel,
> When a backend user logs in the be_typo_user cookie is set.
>
> This can successfully be detected by mod_rewrite using the condition:
> RewriteCond %{HTTP_COOKIE} !be_typo_user
The cookie is set when loading /typo3/index.php, so it can be there even
before the login! Don't trust it, even not for be_users!
> The fe_typo_user cookie is allways set!
>
> Even if a user never logs in.
>
> When a user does log in, the cookie does not change and no new cookies
> are set.
Right. I dislike this behaviour very much. TYPO3 does fe_session checks on
every request, while it could simply skip that if the cookie would only
exist for logged in users. Will try to change soon...
> My aim is to be able to use:
> RewriteCond %{HTTP_COOKIE} !fe_typo_user
>
> So that I can skip rewriting to statically cached files if a frontend
> user is logged in.
> Why is the cookie always set?
That is because of the getKey/setKey feature which offers session based data
storage in the fe_session_data table without requiring any frontend login.
> If this behavior cannot be changed easily I am thinking of hooking into
> the frontend login code to set an extra: no_static cookie which I can
> check against.
Why don't you use a proxy in front of the server? This would cache the pages
according to various cache-control headers.
All you need to do is to
1) set up a proxy system
2) enable config.sendCacheHeaders = 1
3) avoid any INT/EXT inclusion scripts (no USER_INT objects!)
(Well, I know that you want a solution using nc_staticfilecache, but still
I'm curious about the drawbacks of this solution...)
- michael
--
Use a newsreader! Check out
http://typo3.org/community/mailing-lists/use-a-news-reader/
More information about the TYPO3-dev
mailing list