Modified the findexts function

PHP has the pathinfo function to find extensions and other stuff about a file so I used it instead of string manipulation;