A tip I picked up that I thought I’d share. One or two of my sites read data from csv files, or collect email addresses etc into flat files. I discovered that if i created a subdirectory to contain those files, I can use .htaccess to password protect that directory, but the great thing is that PHP scripts and functions can still access it while the rest of the world can’t.
I use cPanelX and it’s easily done through “Web Protect”. Just add a username/password, then select the directory to protect. Works like a charm ” title=”” class=”bbcode_smiley” />
Additionally, if you use Cron jobs, you can put those jobs in the same directory and use the format as follows to run it. Again this stops the world accessing your Cron script:
[PHP]lynx -auth=usernameassword http://www.yoursite.com/protected_directory/your_script.php%5B/PHP%5D
Cheers
Simmo!