Update index.php

REFACTOR overlapping check more readable