credo che sia sconveniente per il tempo che ci mette, no?

p.s.
puoi mettere un solo global:
global $connect, $user, $pass;