Skip to content

Commit

Permalink
Merge branch 'master' of ssh://github.com/kitinfo/pizza-planer
Browse files Browse the repository at this point in the history
  • Loading branch information
cbdevnet committed Mar 22, 2014
2 parents 431ce4d + b140a66 commit 4a80576
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions server/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,13 @@ function changePizza($userid, $to) {
));
return;
}

if ($this->isReady($userid)) {
$out->addStatus("set-ready", array(
"75833", 86, "User is ready."
));
return;
}

$sql = "UPDATE users SET pizza = :pizza WHERE id = :id";

Expand All @@ -324,6 +331,24 @@ function changePizza($userid, $to) {

$stm->closeCursor();
}

function isReady($id) {
global $controller;

$sql = "SELECT ready FROM users WHERE id = :id";

$stm = $controller->exec($sql, array(
":id" => $id
));
$ready = $stm->fetch();

if (count($ready) > 0) {

return $ready[0];
} else {
return false;
}
}

/**
* mark the user as had paid.
Expand Down

0 comments on commit 4a80576

Please sign in to comment.