11

Can anybody tell me the simplest way (or suggest me a tutorial) to save / update / delete usernames and passwords in a .htpasswd file using php?? I am using php5 and Apache 2 in Windows.

hakre
  • 193,403
  • 52
  • 435
  • 836
Alfred
  • 21,058
  • 61
  • 167
  • 249

3 Answers3

21

I like this:

Create file and add username:

htpasswd -c [filename] [username]

Add username into file or update users password:

htpasswd [filename] [username]

Delete user from file:

htpasswd -D [filename] [username]
Jojomatik
  • 156
  • 2
  • 16
giordano
  • 2,954
  • 7
  • 35
  • 57
1

To remove a user: Just open the password file using nano or vim and simply remove the user line that you want to delete...

Junaid
  • 4,682
  • 1
  • 34
  • 40
0

You can use the htpasswd tool. I don't think it can remove the password, but save and update should be ok.

EDIT BTW: I'm not sure of the available operating systems.

M'vy
  • 5,696
  • 2
  • 30
  • 43
  • He is on windows according to the question title. I could be wrong but I don't think htpasswd is available for Windows. Perhaps in Cygwin. – Treffynnon Apr 20 '11 at 15:32