Move session_get out of the loop