Reputation: 5478
I am using a csv file to authenticate user login. Is it possible to password protect the CSV file? I do not want anybody to be able to download the csv file through url. I googled and I found out that it is not possible to password protect a csv file. Is there any other way I can password protect the file?
Upvotes: 2
Views: 11763
Reputation: 1821
If using Apache, use a .htaccess file to deny access to that file. Better still, store the file somewhere above the webroot. For example, if your webserver is located at /home/username/htdocs/
, you could store the file at /home/username/data/logins.csv
.
Upvotes: 1
Reputation: 11710
If you're worried about someone downloading the file, put it someplace that isn't downloadable. Your webserver will only return files from a specific set of directories. If your CSV file is not in one of them, nobody will be able to download it.
Upvotes: 0
Reputation: 1005
the short answer is no: CSV is a plain text format, it's not Excel.
the long answer is: you should never put security relevant information into a folder which is accessible via the webserver. move the file into a folder you can access from PHP but which is outside of your document root in Apache
Upvotes: 11
Reputation: 36512
Compress it in a ZIP file using encryption. You'll have to decompress/unencrypt it each time you want to read from it, however.
See Powerarchiver, winrar, or other compression utilities for more information.
Upvotes: 1