PHP - Solution - Mot de passe de fichier Protect
Question
Donc, j'ai un client qui demande une solution aux fichiers de protection par mot de passe.Il veut essentiellement avoir une solution similaire à Opendocman.Cependant, il m'a montré quelque chose à partir d'un autre client que le mot de passe fondamentalement protège le fichier, aucun nom d'utilisateur.Il peut donc télécharger des fichiers, mettre un mot de passe sur ce fichier, envoyer des liens directement sur ce fichier, puis lorsque les utilisateurs cliquent sur un lien qu'elles sont invitées avec le mot de passe, puis les clients le mettent dans et le fichier est libéré.Tout le monde connaît une solution pouvant faire cette exigence exacte?
La solution
You can setup a basic validation page so that when a user visits a page they enter the document id (or it's encoded in the link) and you put up a simple form with a password field and a submit button.
If the password matches what is stored in the database for that document id. send that file to the user.
Keep the uploaded files outside the /web
directory so you don't have to worry about people hacking the system by guessing filenames.
The files themselves won't have passwords on them, but the only way from the outside to get the file is to have the password.
Autres conseils
If you don't have to have a unique password for every file, you can try apache's mod_auth. You drop a .htaccess & .htpasswd file in the directory you want to protected, and update the users/passwords in the .htpasswd file.
If you want something more dynamic, try mod_auth_mysql, so you have better control from your application.