Search the Community
Showing results for tags 'crypt htpasswd'.
-
I have a PHP file that generates a htpasswd file based on a different password each day. The part of the code that does this is shown below: <?php $clearTextPassword = $passstrings[$TodayDay]; $password = crypt($clearTextPassword, base64_encode($clearTextPassword)); $filepath = '/home/passwd'; // if the file exits, change the permissions if (file_exists($filepath)) { chmod($filepath, 0777); } // open password file to write $fp = fopen($filepath, "w"); // write today's password phrase fputs($fp, "mfsaccess01:$password\r\n"); // change permissions chmod($filepath, 0644); // close passwd file fclose($fp); echo '<h2 align="center">The password for today is the FIRST THREE WORDS found on page '.$pagenum[$TodayDay].'<br> in the MFS book (first paragraph, not title). Please do not add punctuation. Include spaces and exact case.</h2>'; ?> [/code The actual passwords are not shown in this code. It is a list of passwords in an array that is chosen based on the day and placed into the $clearTextPassword variable. This code worked without any problems when I had my files on the Pair.com servers. Recently I moved this code to my GoDaddy server. The code DOES generate a password and DOES create a new passwd file, but it appears the .htaccess file does not accept the password it has generated. So I went to a site online and manually created a password in order to test my .htaccess passwd combo. That worked fine. So it is my generated passwd file that seems to be the fault. My question is, does this PHP crypt function work differently on different servers? Is there a setting, or do I need to make some kind of changes in order for this to work on my GoDaddy server? I'm puzzled. Thanks.