Security Help (authentication)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Security Help (authentication)

Post by werlop »

I have a portion of my site protected by a htaccess file.

What I would like to do is log every log in attempt whether it is sucessful or not. The main deatils I would like to find are the person who is attempting to login's username and the password that they are using. This would be then saved to my MySQL server along with some other details such as time and date.

I can do everything so far apart from getting the details the user provided to the htaccess login box. Is it possible to get those details?

Any help would be greatly appreciated.
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

$_SERVER vars:
'PHP_AUTH_USER'
When running under Apache as module doing HTTP authentication this variable is set to the username provided by the user.
'PHP_AUTH_PW'
When running under Apache as module doing HTTP authentication this variable is set to the password provided by the user.
'PHP_AUTH_TYPE'
When running under Apache as module doing HTTP authenticated this variable is set to the authentication type.
Might be useful to log IP as well - although that doesn't always identify a visitor.
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post by werlop »

Thanks :D I will try that out later, I was already logging IP addresses, but I didn't mention it becuase it was already working 8)
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post by werlop »

Hey, it didn't seem to work. I was pondering this for a while until i realised I was running PHP as a CGI! :oops: Doh, why I set it up like that I don't know but its working fine when I upload the script to my linux server. :D

Incedentally, how difficult is it to remove PHP as a CGI and install it as a module, and how long would it take :?:

Thanks very much :!:
Post Reply