[pmwiki-users] Cookie conflict

Patrick R. Michaud pmichaud at pobox.com
Mon Sep 12 10:03:54 CDT 2005

On Mon, Sep 12, 2005 at 02:34:27PM +0200, Joachim Durchholz wrote:
> Patrick R. Michaud wrote:
> >I think I'll just create an $AuthorCookie variable so the site 
> >administrator
> >can choose the cookie name.  Perhaps also a $CookiePrefix so that
> >one can prefix any cookies that PmWiki sets.
> Does $AuthorCookie give us anything that $CookiePrefix doesn't?
> If not, I'd drop $AuthorCookie and stick with $CookiePrefix. 

Excellent point -- I'll go with that.

> * I can also conceive that some recipes might want to set cookies (not 
> sure how much of a factor that would be - there's always $_SESSION[], 
> which is less of a hassle and better in most if not all respects).

The big difference between $_SESSION[] and $_COOKIE[] is that
sessions expire within short periods of time while cookies can be
set to extend over much longer periods of time.  The other difference
is that data held in $_SESSION is held locally on the server (i.e.,
not transmitted), while data in $_COOKIE is transmitted and stored
on the client's machine.

So, $_COOKIE is good for settings that need to be retained over time
(author, skin and browser preferences), while $_SESSION is better for
authorization data and per-visit sorts of details.


More information about the pmwiki-users mailing list