Update index.php

Changed method for checking if a page exists.