Use redirect_to session variable (which is set in the isLoggedIn
function) instead of index.php if that variable is set.