[Wylug-help] HTTP authentication error redirector

Gary Stainburn gary.stainburn at ringways.co.uk
Thu, 23 Jan 2003 17:00:29 +0000


Hi folks,

I've got the following code which works great on Netscape/Mozilla browsers.
If the user hits the escape key at the user ID and password window, the text
specified is rendered in the browser and the user is redirected to the
relevent error page.

However, this doesn't work with MS browsers as they don't honour the
HTTP-EQUIV meta-tag.  Has anyone got a workaround that I could try?

  function getauth($realm) {
    if (!$realm) {
      $realm='Restricted NYMR';
    }
    global $secure;
    header("WWW-Authenticate: Basic realm=\"$realm\"");
    header('HTTP/1.0 401 Unauthorized');
    echo("<html><head><title>Unauthorised access</title><meta
http-equiv=\"Location\"
content=\"http://www.stainburn.com/nymr/noentry.html?$secure\"></head><body></body></html>");
    exit;
  }

--
Gary Stainburn

This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000