added php code for thresholds