Hi All,
I'm using the cPanel File Manager to set passwords on directories and write a custom application to authenticate users into those directories. For example:
1) Login to cpanel
2) Set a username and password on a directory under Password Protect Directories
3) Acces our custom PHP application and inside of it ompare the string passed by the user and what was generated in the under /home/SITENAME/.htpasswds/public_html/DIRECTORY/passwd
This is where the problem starts - we cannot seem to get the passwords to match when encrypted the new one with the one found inside of the passwd file.
I found a useful function to address the whole apr nature of the encryption from a function called function crypt_apr1_md5($plainpasswd) on PHP: crypt - Manual by another user. I was able to generate a string with the apr function; however, the salt is always going to be random.
While the version in the passwd file is something like:
Any pointers on how to compare encrypted passwords generated by Password Protect Directories inside of cPanel would be greatly appreciated.
Thank you.
I'm using the cPanel File Manager to set passwords on directories and write a custom application to authenticate users into those directories. For example:
1) Login to cpanel
2) Set a username and password on a directory under Password Protect Directories
3) Acces our custom PHP application and inside of it ompare the string passed by the user and what was generated in the under /home/SITENAME/.htpasswds/public_html/DIRECTORY/passwd
This is where the problem starts - we cannot seem to get the passwords to match when encrypted the new one with the one found inside of the passwd file.
I found a useful function to address the whole apr nature of the encryption from a function called function crypt_apr1_md5($plainpasswd) on PHP: crypt - Manual by another user. I was able to generate a string with the apr function; however, the salt is always going to be random.
Code:
$apr1$f0usodex$pX1L0ciSNZtR3HRx6eGsm0
Code:
$apr1$qiC5Xk6S$LBAAJxUfDHN3Uz83bni6D/
Thank you.