You may need to password protect a file before sending it to someone. Yes, there are Windows utilities, some free, that do this but I found this script works surprisingly well as long as “zip” is installed on your server. Just simply save the following file below to your website then upload the file you want to password protect. Be sure to rename “file.txt” in the below example to the name of the file you want to password protect and rename the “file.zip” to the name you want it output as then execute this script in the browser. All you should have to do is download the ZIP archive version of this file.
<?php $path=$_SERVER['DOCUMENT_ROOT'].'/pathToThisUtility/'; $path=''; echo system("zip -P pass ".$path."file.zip $path"."file.txt"); ?>
When you download the file, you should be prompted with a password before opening.
– Aaron Belchamber