🐛 User not added to DB - force die() on error (#118)

* 🐛 User not added to DB - force die() on error

Signed-off-by: Luke Tainton <luke@tainton.uk>

* Restyled by php-cs-fixer (#119)

Co-authored-by: Restyled.io <commits@restyled.io>

Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <commits@restyled.io>
This commit was merged in pull request #118.
This commit is contained in:
2020-08-17 16:17:06 +01:00
committed by GitHub
parent 7a4a1074c5
commit 5ff90e0d78
2 changed files with 51 additions and 41 deletions

View File

@@ -6,6 +6,22 @@
return $version;
}
function user_exists($db, $uuid)
{
try {
$sql = $db->prepare("SELECT uuid FROM users WHERE uuid=:uuid");
$sql->bindParam(':uuid', $uuid);
$sql->execute();
} catch (PDOException $e) {
$alert = array("danger", "Error during check for user record: " . $e->getMessage());
}
if (empty($sql)) {
return false;
} else {
return true;
}
}
function get_all_users($db)
{
try {