Check that $_SESSION["uid"] is defined before checking value 

This avoids errors in apache logs.