troubleshooting Question

Match (preg_match) user/pass to htpasswd file

Avatar of lopband
lopband asked on
4 Comments1 Solution276 ViewsLast Modified:

I have a  htpasswd file with a lot of user/password combos like this:

test:dGRkPurkuWmW2 (test:test)
test1:dGlAW3zdxeAG2 (test1:test1)
test2:dG/F7fZAgYRys (test2:test2)
test3:dGXpGzCltZZ72 (tes3t:test3)

I want to use a login form instead of BASIC_AUTH to authenticate my users...
so first we gotto get the values from the form (member_username,member_pass) then open my htpasswd:

$file = file_get_contents('/full/path/to/htpasswd');

Then I guess we have to preg_match the array and use array_flip/array_slice??

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros