PHP and .htaccess

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • splodge

    PHP and .htaccess

    Hello,

    I am building a website, part of which reuires user authentication. In
    the past I have used PHP and MYSQL to do this, but I was wondering if
    there is an easy wasy to use .htaccess. On the face of it this looks
    simple but each page the site returns is user specific, so I need a way
    of finding out which user logged in.

    For example if John logged in he would see page A
    If Suzy logged in she would see page B.

    I am thinking that there might be something in the page headers that I
    can get hold of, I'm just not sure what.

    Any help greatly welcome.

    Regards.
  • Al

    #2
    Re: PHP and .htaccess

    Try $_SERVER['PHP_AUTH_USER'] maybe.
    And $_SERVER['PHP_AUTH_PW'] gets the password.

    See http://uk.php.net/manual/en/features.http-auth.php for full details.

    Comment

    • splodge

      #3
      Re: PHP and .htaccess

      Al wrote:[color=blue]
      > Try $_SERVER['PHP_AUTH_USER'] maybe.
      > And $_SERVER['PHP_AUTH_PW'] gets the password.
      >
      > See http://uk.php.net/manual/en/features.http-auth.php for full details.
      >[/color]

      Many thanks for that, all sorted now.

      Comment

      • Justin Koivisto

        #4
        Re: PHP and .htaccess

        splodge wrote:[color=blue]
        > Al wrote:[color=green]
        >> Try $_SERVER['PHP_AUTH_USER'] maybe.
        >> And $_SERVER['PHP_AUTH_PW'] gets the password.
        >>
        >> See http://uk.php.net/manual/en/features.http-auth.php for full details.
        >>[/color]
        >
        > Many thanks for that, all sorted now.[/color]

        Also, for an implementation example, you can check out:


        --
        Justin Koivisto, ZCE - justin@koivi.co m

        Comment

        • Charlie King

          #5
          Re: PHP and .htaccess

          On 12 Jan 2006 11:38:09 -0800, in
          <1137094689.817 396.152580@z14g 2000cwz.googleg roups.com>
          (comp.lang.php) "Al" <alexrussell101 @gmail.com> wrote:
          [color=blue]
          > Try $_SERVER['PHP_AUTH_USER'] maybe.
          > And $_SERVER['PHP_AUTH_PW'] gets the password.
          >
          > See http://uk.php.net/manual/en/features.http-auth.php for full details.[/color]


          It's worth noting that those will only retrieve .htaccess USER and PW
          if PHP running as an Apache module, and not if it's running as CGI.
          --
          Charlie

          Comment

          Working...