David Guerizec wrote:
> > But won't that only work on a page where you *have* to be logged in on ?
> > Is there a way of saying "if there is a user logged in, get their userid,
> > otherwise just serve a plain page ?"
>
> if the user is not logged in, $midgard->user will be set to 0 (there is
> no user with such a userid)
I think the easiest way to do what you outlined is have a page set
without
authentication, have form elements where a username an password can be
entered,
and when you get them send them back to the browser in a cookie, for
example:
OptionalUserName=username
OptionalPassword=password
and then in the topof the page (or in the style, probably), do:
if ($OptionalUserName && $OptionalPassword) {
mgd_auth_midgard($OptionalUserName, $OptionalPassword, 0);
$midgard = mgd_get_midgard();
}
This will set $midgard->user to the appropriate ID, if any, and if auth
succeeded
the rest of the page will run as were the user authenticated as with a
normal
auth-required page.
Note that I would not advocate using cookies for sensitive stuff.
Emile
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]