connect()) { logdie("ERROR Database connect error"); } # Check if key exists $r = $db->findBy('yubikeys', 'yk_publicname', $yk, 1); if ($db->rowCount($r) != 1) { logdie("ERROR Unknown yubikey: $yk"); } # Enable/Disable the yubikey if (!$db->updateBy('yubikeys', 'yk_publicname', $yk, array('active'=>($do == "enable" ? "TRUE" : "FALSE")))) { logdie("ERROR Could not $do for $yk (rows $rows)"); } # We are done logdie("OK Processed $yk with $do"); ?>