This sounds like a good solution. Perhaps I can figure out some way to use it.
What I am planning on doing is having users be able to upload their own HTML files, image files etc etc -- and then... (long story short) be able to have my own self-contained "virtual" web hosting, where the users get a certain amount of space to use. Their files would therefore be uploaded like regular files, right onto the filesystem; this is fine, except I don't want these users to have access to PHP (which comes inevitably if they have their files on the filesystem). My web host has it enabled to where .html files are processed in PHP (I have to have it this way anyway, because my whole site is using PHP with .html extensions).
My solution to restricting my users files from having access to PHP is by using tricky .htaccess and Not Found pages -- to when a request comes up for http://server.com/userdirectory/file.html, for example, it will call my Not Found script. The Not Found page will locate the user's file (which is located in a separate folder) and transparently "include()" the requested file, not parsed by PHP.
So, inevitably it comes to this: is there some way that I can use some tricky functions (preferrably string functions, they're quicker, but if all else fails: regular expressions) to scan the requested user file before it is outputted and remove all <? and <?php and <SCRIPT LANGUAGE="php"> in the file.
Do you have any suggestions on how I would accomplish the removal of the PHP opening tags? Thanks! (Whew, what a lot of typing!) 🙂