Fixed Security problems, Download controller

Added validations in file uploader and a white list of files that can be
uploaded. Added controller in index.php, fixed sql injection and xss
vulnerabilities, made functions to return boolean variables and fixed
download controller. Mainly finished 5th exercise.