Results 1 to 5 of 5

Thread: .htaccess username to a php script?

  1. #1
    Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    163
    Thanks
    0
    Thanked
    0 times in 0 posts

    Question .htaccess username to a php script?

    hi. i hav a website where ive made user's with cpanel, which uses standard .htaccess to authorize users.

    i wondered if there was any way of having a php script that could detect the user?

    for example, some1 navigates to
    they are asked for a user and password.
    they log in with username "john" and password "smith1".
    and they continue on to that folder, where they'll see the contents of index.php.

    is there something i could put in index.php that would return "john" ???

    thanx in advance

  2. #2
    Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    163
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: .htaccess username to a php script?

    i know i didn't really wait long for a reply, but its ok now, i found it.

    $REMOTE_USER returns the username that was used. thanx anyway

  3. #3
    Large Member
    Join Date
    Apr 2004
    Posts
    3,720
    Thanks
    47
    Thanked
    99 times in 64 posts

    Re: .htaccess username to a php script?

    You should use $_SERVER['REMOTE_USER'].
    To err is human. To really foul things up ... you need a computer.

  4. #4
    Member
    Join Date
    Dec 2006
    Location
    UK
    Posts
    163
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: .htaccess username to a php script?

    difference?

    is it more secure? or...?
    Last edited by hsncool; 03-12-2007 at 01:44 AM. Reason: didnt want to sound like i was giving attitude so extended my question :)

  5. #5
    www.dougmcdonald.co.uk
    Join Date
    May 2007
    Location
    Bath
    Posts
    523
    Thanks
    5
    Thanked
    20 times in 20 posts
    • DougMcDonald's system
      • Motherboard:
      • Asus P5B Deluxe
      • CPU:
      • Inter Core 2 Duo E6600
      • Memory:
      • 2 x 2GB - Geil Black Dragon PC6400
      • Storage:
      • 2 x 400GB Samsung Spinpoints (Running in Matrix array) 100GB @ RAID0 + 300GB @ RAID1
      • Graphics card(s):
      • BFG nVidia 8800GTS 320MB OC2
      • PSU:
      • Corsair HX520W modular
      • Case:
      • Lian-Li PC7 II Plus
      • Monitor(s):
      • LG 17" Flat Thingy
      • Internet:
      • Crappy BT 1MB Unreliable wank :s

    Re: .htaccess username to a php script?

    Yes, secure, and the fact that you could overwrite the variable $REMOTE_USER by writing a url query string such as index.php?REMOTE_USER=steve (depending on server settings)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP Script Suggestions.
    By just_laze in forum Help! Quick Relief From Tech Headaches
    Replies: 3
    Last Post: 23-03-2006, 04:54 AM
  2. Replies: 2
    Last Post: 02-03-2006, 03:11 PM
  3. Replies: 0
    Last Post: 10-02-2006, 11:28 PM
  4. Simple Banner Script Javascript or PHP Advice
    By ikonia in forum Software
    Replies: 2
    Last Post: 12-07-2005, 08:29 PM
  5. PHP script errors after moving hosts..
    By Stoo in forum Software
    Replies: 15
    Last Post: 15-07-2004, 12:31 AM

Posting Permissions

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