Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts

    SOLVED: using htaccess username in php script

    I want to use the browser login and use the login information.

    http://seeitsolutions.com.au/layouts

    For example, if you login with username and password, could php find who was logged in and use the username to determine what is displayed? If so, how do I get that info?
    Last edited by SeeIT Solutions; 11-13-2006 at 07:44 AM. Reason: Solved

  • #2
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    SeeIT,
    Was that (the link) setup using directory protection? if it was I dont think php can pick up the user-id I cant think of any server variable that would have that info.
    Why not just write a log-in page/script with MySQL in the back? if you need help with that let me know.
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #3
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Yes that was done by directory protection.

    I didn't want to do that because I couldn't be bothered Also, the login determines what database it will access so the login would need to be hard coded.

  • #4
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    I use a webmail client that does this though. Horde webmail takes login from the browser and then uses that. So does cpanel.

  • #5
    Regular Coder musher's Avatar
    Join Date
    Jan 2005
    Location
    Minnesota
    Posts
    203
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by SeeIT Solutions View Post
    I use a webmail client that does this though. Horde webmail takes login from the browser and then uses that. So does cpanel.

    Yea SeeIt I use Horde to, but mine uses a login page/script. hmmm weird.
    Thanks
    Jim M

    "Lord, help me to become the person my dog thinks I am" - Dawn Ewing
    "If you must know. Yes, I do enjoy running after the dog sled when I fall off" - Me

    www.huskyzone.com -- Woodland Siberians

  • #6
    Regular Coder
    Join Date
    May 2005
    Posts
    563
    Thanks
    0
    Thanked 3 Times in 3 Posts
    After a lot of searching it is possible.

    It is stored in the $_SERVER array under...

    'PHP_AUTH_DIGEST'
    When running under Apache as module doing Digest HTTP authentication this variable is set to the 'Authorization' header sent by the client (which you should then use to make the appropriate validation).


    'PHP_AUTH_USER'
    When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the username provided by the user.


    'PHP_AUTH_PW'
    When running under Apache or IIS (ISAPI on PHP 5) as module doing HTTP authentication this variable is set to the password provided by the user.


    'AUTH_TYPE'
    When running under Apache as module doing HTTP authenticated this variable is set to the authentication type.
    That can be found at the php site here: http://php.net/manual/en/reserved.variables.php


  •  

    Posting Permissions

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