4

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
  • 184,866
  • 48
  • 414
  • 792
Alfred
  • 20,303
  • 60
  • 160
  • 239

3 Answers3

14

I like this:

Create file and add username:

htpasswd -c [filename] [username]

Add username into file:

htpasswd [filename] [username]

Delete user from file:

htpasswd -D [filename] [username]
giordano
  • 2,639
  • 4
  • 31
  • 55
0

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,105
  • 1
  • 30
  • 37
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,498
  • 2
  • 28
  • 42
  • 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