generate_encryption_key(),$new); // Write the new config.php file $handle = fopen($output_path,'w+'); // Chmod the file, in case the user forgot @chmod($output_path,0777); // Verify file permissions if(is_writable($output_path)) { // Write the file if(fwrite($handle,$new)) { return true; } else { return false; } } else { return false; } } // Generate a per-install encryption key for the application config. private function generate_encryption_key() { try { return bin2hex(random_bytes(32)); } catch (Exception $e) { if (function_exists('openssl_random_pseudo_bytes')) { return bin2hex(openssl_random_pseudo_bytes(32)); } return sha1(uniqid('', true) . mt_rand()); } } } ?>