Sökvägen till AuthUserFile har jag fått fram m.h.a:
$dir = dirname(__FILE__);
echo $dir
Besöker jag sidan så får jag upp prompten som ber om lösenord, så långt funkar det. Men när jag anger "admin" och "test" så kommer jag inte vidare. Prompten dyker upp igen, precis som om jag angivit fel uppgifter...
du ska inte ange lösenordet i klartext.
om du har installerat apache på din dator så finns det ett program (htpasswd) som du ska köra i ett kommando-fönster för att generera lösenordet.
C:\Apache\bin>htpasswd
Usage:
htpasswd [-cmdpsD] passwordfile username
htpasswd -b[cmdpsD] passwordfile username password
htpasswd -n[mdps] username
htpasswd -nb[mdps] username password
-c Create a new file.
-n Don't update file; display results on stdout.
-m Force MD5 encryption of the password (default).
-d Force CRYPT encryption of the password.
-p Do not encrypt the password (plaintext).
-s Force SHA encryption of the password.
-b Use the password from the command line rather than prompting for it.
-D Delete the specified user.
On Windows, NetWare and TPF systems the '-m' flag is used by default.
On all other systems, the '-p' flag will probably not work.
Jag skapade en användare admin med lösenordet test och fick följande sträng i min fil.
du ska inte ange lösenordet i klartext.
om du har installerat apache på din dator så finns det ett program (htpasswd) som du ska köra i ett kommando-fönster för att generera lösenordet.
C:\Apache\bin>htpasswd
Usage:
htpasswd [-cmdpsD] passwordfile username
htpasswd -b[cmdpsD] passwordfile username password
htpasswd -n[mdps] username
htpasswd -nb[mdps] username password
-c Create a new file.
-n Don't update file; display results on stdout.
-m Force MD5 encryption of the password (default).
-d Force CRYPT encryption of the password.
-p Do not encrypt the password (plaintext).
-s Force SHA encryption of the password.
-b Use the password from the command line rather than prompting for it.
-D Delete the specified user.
On Windows, NetWare and TPF systems the '-m' flag is used by default.
On all other systems, the '-p' flag will probably not work.
Jag skapade en användare admin med lösenordet test och fick följande sträng i min fil.
admin:$apr1$L51.....$gTKrrXWejNk6LBopA/KTi1
Tack nu fungerar det! Tänk ibland är det så enkelt... :)
265 ms totalt · 4 externa anrop · v20260731065814-full.6fe65c25