Hi,

I want to build a user interface that is intertwined with the actual site
(see also old posting at
http://marc.theaimsgroup.com/?l=midgard-user&m=101216685605970&w=2).
What I mean is that authenticated users will surf and see the same site as
when non-authenticated, apart from extra links such as:

"delete this article",
"update this article",
"create new topic"...

The way I was planning to do this, was to make a separate login page with a
form, where I could set the MidgardLogin cookie.
According to the explanation in
http://www.midgard-project.org/manual/en/function.auth-midgard.php, "The
Midgard code will not see the difference between a user logged in by HTTP
authentication or the cookie login".  I don't want to bother my slightly
technofobic users with authentication request popups.

However, when visiting other pages of the site after login, it appears that
$Midgard->user is not set, although the cookie has been set...  this even
shows as I refresh my login page, without doing the post, but by retyping
the URL.

So how can I make sure that the site can recognize authenticated users
(those having logged in via the form on the login page) and
non-authenticated (not even knowing about the existence of the form).

The login page is something as (linked with the Empty style):

<?
    $sitegroupname="MySiteGroupName";
    //before output is sent
    if (isset($Name))
    {
      $authenticated = mgd_auth_midgard ($Name."+$sitegroupname", $Password,
1);
      // refresh midgard object
      $midgard = mgd_get_midgard();
    }
?>

<form method="POST" action=" <? echo $PHP_SELF ?> ">
<p>
Name:&nbsp;&nbsp;
<input type="text" name="Name" size="20">
</p>
<p>
Password:&nbsp;&nbsp;
<input type="password" name="Password" size="20">
</p>
<p>
<input type="submit" value="Login" name="Submit">
</p>
</form>

<?
     //display control info
  echo "submitted Name value: ".$Name."<br>";
  echo "submitted Password value: ".$Password."<br>";
  echo "Result of mgd_auth_midgard : ".$authenticated."<br>";
  echo "midgard->host displays: ".$midgard->host."<br>";
  echo "midgard->user displays: ".$midgard->user."<br>";
  echo "midgard->admin displays: ".$midgard->admin."<br>";
  echo "Midgardlogin Cookie is: ".$HTTP_COOKIE_VARS["MidgardLogin"]."<br>";
?>

I chose to refresh the midgard object (line 8) after reading the discussion
on
http://marc.theaimsgroup.com/?t=101341794900002&r=1&w=2
and I added the sitegroupname (line 6) after reading
http://marc.theaimsgroup.com/?t=99645144200004&r=1&w=2

Regards,

pascal



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to