Skip to content
Browse files

checking for existence prior to ->appending

  • Loading branch information...
1 parent d85bea0 commit cffe9b0b4bb2a8d415a4987132ec0cb3c9988b26 @BigBlueHat BigBlueHat committed May 14, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 beers.php
View
7 beers.php
@@ -48,6 +48,11 @@ function breweryUrl($name) {
// TODO: handler errors
$beer_id = 'beer_' . str_replace(' ', '_', urldecode($id));
- $cb->append(sha1($_SESSION['email']), $beer_id . '|');
+ $email = sha1($_SESSION['email']);
+ if ($cb->get($email) !== null) {
+ $cb->append($email, '|' . $beer_id);
+ } else {
+ $cb->set($email, $beer_id);
+ }
$app->redirect('../beers/' . $id);
});

0 comments on commit cffe9b0

Please sign in to comment.
Something went wrong with that request. Please try again.