$router->uParameters[1], ":ConfirmationKey" => $router->uParameters[2]), 0, true); $sSubscription->uIsConfirmed = true; $sSubscription->InsertIntoDatabase(); flash_notice("Your subscription was successfully confirmed. Welcome on board!"); redirect("/manage/{$sSubscription->sEmailAddress}/{$sSubscription->sSettingsKey}"); } catch (NotFoundException $e) { try { $sUser = User::CreateFromQuery("SELECT * FROM users WHERE `EmailAddress` = :EmailAddress AND `ActivationKey` = :ActivationKey AND `Activated` = 0", array(":EmailAddress" => $router->uParameters[1], ":ActivationKey" => $router->uParameters[2]), 0, true); $sUser->uIsActivated = true; $sUser->InsertIntoDatabase(); $sUser->Authenticate(); flash_notice("Your account was successfully activated. Welcome on board!"); redirect("/dashboard"); } catch (NotFoundException $e) { /* No user or subscription with this e-mail address and verification key exists. Bail out. * We'll throw a RouterException so that we only have to deal with 404s in one place. */ throw new RouterException("Confirmation key not found."); } }