I have built a little user based content management system that is working well and is teaching me a lot about PHP/mySQL. I've got file uploads working, and it's cool cuz authenticated users can upload files and they will be listed so others can download them, etc. Not a new concept at all of course, but I got it working by myself, so that's cool...
Here is my question: How do I make sure that no one (yes, they will be authenticated users, but i still don't trust them) uploads a file like printyourpassword.php and then just enters: mysite.com/cms/files/printyourpassword.php to execute, I want to make sure that this doesn't happen with ASP or CGI files either, or with ANY kind of files that would compromise the security of the site or my server.
Right now, I use a lame method of not allowing any files with with titles that contain ".php", ".cgi", etc... to even be uploaded, but this CAN'T be the most secure way of dealing with this problem can it!?!??!
Thanks.