Results 1 to 9 of 9

Thread: HTTP Auth woes

  1. #1

    Thread Starter
    Lively Member Tw1sted L0gic's Avatar
    Join Date
    Jan 2005
    Posts
    88

    HTTP Auth woes

    Hi,
    I've installed PHPWiki and my authentication doesn't work.
    It simply rejects my correct username/password.
    Here's the auth code. It seems fine to me.

    Code:
       // Set these to your preferences. 
       // For heaven's sake pick a good password!
       $wikiadmin   = "myuser";
       $adminpasswd = "mypass";
    
       // Do not tolerate sloppy systems administration
       if (empty($wikiadmin) || empty($adminpasswd)) {
           echo gettext("Set the administrator account and password first.\n");
          exit;
       }
    
       // From the manual, Chapter 16
       if (($_SERVER['PHP_AUTH_USER'] != $wikiadmin  )  ||
           ($_SERVER['PHP_AUTH_PW']   != $adminpasswd)) {
    
         Header("HTTP/1.0 401 Unauthorized"); 
      Header("WWW-Authenticate: Basic realm=\"PhpWiki\"");
        
    
          echo gettext("You entered an invalid login or password." 
          exit;
       }
    Naughty but Nice

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: HTTP Auth woes

    What server is it hosted on, because IIS doesn't like HTT Auth from PHP. If it is IIS then it can be configured to allow this. Gimmie a sec and I'll dig out the link.

  3. #3

    Thread Starter
    Lively Member Tw1sted L0gic's Avatar
    Join Date
    Jan 2005
    Posts
    88

    Re: HTTP Auth woes

    Thanks for your help.
    I'm on:
    Apache 1.3.34 (Unix): PHP v4.4.1 (suExec enabled)
    MySQL v4.0.25-standard.

    It's not my server. I'm paying for some server space.
    The php script was in fact provided by my ISP. It installs automatically (i provide a couple of basic settings and the rest is automated.)

    I'll ask my ISP if all else fails.
    Thanks
    Naughty but Nice

  4. #4
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: HTTP Auth woes

    Your code seem valid, and nothings wrong with it. Have you tried printing out the values $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] when it failed to see if the information was sent correctly or at all?

  5. #5

    Thread Starter
    Lively Member Tw1sted L0gic's Avatar
    Join Date
    Jan 2005
    Posts
    88

    Re: HTTP Auth woes

    Yeah, they seem to be blank. So the message isn't getting through.
    Any ideas?

    I've tried firefox and IE by the way. same problem.
    Naughty but Nice

  6. #6
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: HTTP Auth woes

    Hmm try contacting your host because as far as i can tell it appear to be a problem with your host. They might be able to shed some more light on the situtation.
    Last edited by john tindell; Mar 21st, 2006 at 08:57 PM. Reason: Bad spelling :eek2:

  7. #7

    Thread Starter
    Lively Member Tw1sted L0gic's Avatar
    Join Date
    Jan 2005
    Posts
    88

    Re: HTTP Auth woes

    Ok will do.
    Thanks very much for your help.
    Naughty but Nice

  8. #8
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: HTTP Auth woes

    No worries, Can you please mark the thread as resolved

  9. #9
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Re: HTTP Auth woes

    If php's set up as a cgi, then the apache authentication hooks don't work.

    You'd need to speak to your host to investigate that / to change it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width