#1
  1. No Profile Picture
    PHP Programmer
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    31
    Rep Power
    15
    This is the example of HTTP authentication from php.net. I've read it 10 times and tried it, but I can't get it to work. Can someone explain what happens here? is $PHP_AUTH_USER an environment variable? Can I access it from every page?

    <?php
    if(!isset($PHP_AUTH_USER)) {
    Header("WWW-Authenticate: Basic realm="My Realm"");
    Header("HTTP/1.0 401 Unauthorized");
    echo "Text to send if user hits Cancel buttonn";
    exit;
    } else {
    echo "Hello $PHP_AUTH_USER.<P>";
    echo "You entered $PHP_AUTH_PW as your password.<P>";
    }
    ?>

    I've heard that there is a way to make variabes availible to all pages, putting them in some sort of global file. Can I use that for authentication?
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    This type of authentication only works if PHP is installed as an Apache module. It won't work if you are using PHP as a CGI.

Similar Threads

  1. Garbled HTTP Submit
    By lustyx in forum Perl Programming
    Replies: 5
    Last Post: August 11th, 2003, 07:37 PM
  2. Slow upload of large files via HTTP form
    By enclume42 in forum HTML Programming
    Replies: 0
    Last Post: February 11th, 2003, 12:21 PM
  3. http process consume lots of cpu
    By dkhambit in forum Apache Development
    Replies: 1
    Last Post: October 3rd, 2002, 09:58 AM
  4. HTTP environmental variables not found?
    By tbonds67 in forum Apache Development
    Replies: 5
    Last Post: January 3rd, 2002, 05:12 AM
  5. IBM HTTP SERVER 1.3 = Apache Server
    By fazal in forum Apache Development
    Replies: 0
    Last Post: April 29th, 2001, 06:12 AM

IMN logo majestic logo threadwatch logo seochat tools logo