No try/catch on PHP 4. I don't know what your functions are or what they return, but from what's there, I'd do this:
PHP Code:
//catch the exception that gets thrown if the cookie has an invalid session_key in it
if (!$fb->api_client->users_isAppAdded()) {
$fb->redirect($fb->get_add_url());
} else {
//this will clear cookies for your application and redirect them to a login prompt
$fb->set_user(null, null);
$fb->redirect($appcallbackurl);
}
Also, given the host thread, I'd suggest getting one of the recommended hosts.