A weighted Brun-Titchmarsh inequality