I have a PHP page which, using sessions, checks a person's security level, and then only displays the Word and Acrobat files that the person is cleared to see. This seemed like fine security at first, but I have found a problem. A manager can see lots of files most people can't. Say a manager right-clicks a link to a file, copies the URL, and emails the URL to an employee. That employee directly accesses the Word or Acrobat file, bypassing the "secure" PHP page. Suddenly my security fails.
How do you guys deal with this issue? I think a couple alternatives might be to use "chown" and "chgrp" to secure files at a server level, or else to filter everything through a PHP page -- but how do I know what "Content-type" header to send? Do I maintain a list of every file extension used and the header that goes with it? Or can I leverage something else?