set_time_limit added for every update function to be sure that the script can execute all querys
Fixed detection of mysqli connection status
Fixed mixed line endings