SQL Injection fix and others

Fixed SQL Injection

Fixed DB test button and related functionality.

Fixed $request variable warning messages

Fixed loop error while trying to loop through an empty aircraft list.