Gauge fluxes in F-theory and type IIB orientifolds