Fixed typo in includes
Added security check: restrict which calling scripts get access to the database or can upload files
Some cleanup