[pmwiki-users] authuser / Setting the Author Automatically - all blank

H. Fox haganfox at users.sourceforge.net
Wed Feb 8 10:43:28 CST 2006


On 2/8/06, Dominique Faure <dominique.faure at gmail.com> wrote:
> The "cleanest" way would be to write (no string constants):

You're right.

> include_once("$FarmD/scripts/author.php");
> if($AuthId && ! stripmagic(@$_COOKIE[$AuthorCookie])) {
>   $Author = $AuthId ;
>   setcookie($AuthorCookie, $Author, $AuthorCookieExpires, $AuthorCookieDir);
> }
>
> Nota: The cookie prefix is only required to enable fields isolation.

Not necessarily because some other script besides PmWiki might set a
cookie with a name of "author".

The cookie prefix should be included regardless.  Having the prefix
there and not needing it is of no consequence, but needing prefix
there and not having it means you'll set a cookie with the wrong name.

So now we have

    include_once("$FarmD/scripts/author.php");
    if($AuthId && !@$_COOKIE[$CookiePrefix.$AuthorCookie]) {
      $Author = $AuthId; setcookie($CookiePrefix.$AuthorCookie,
        $Author, $AuthorCookieExpires, $AuthorCookieDir); }

Hagan




More information about the pmwiki-users mailing list