Refactor event registration
This commit is contained in:
parent
6ea6fcddc3
commit
c202c4edef
|
@ -34,14 +34,12 @@ function get_event_id($cfg, $token) {
|
|||
|
||||
function register_event($cfg) {
|
||||
$body = json_decode(file_get_contents('php://input'));
|
||||
$event_id = get_event_id($cfg, $body->event_token);
|
||||
$event_token = $body->event_token;
|
||||
if (get_event_id($cfg, $token)) {
|
||||
if (get_event_id($cfg, $body->event_token)) {
|
||||
return ["success" => false];
|
||||
}
|
||||
$query = "INSERT INTO events (token) VALUES (?)";
|
||||
$stmt = $cfg['mysqli']->prepare($query);
|
||||
$stmt->bind_param("s", $event_token);
|
||||
$stmt->bind_param("s", $body->event_token);
|
||||
$stmt->execute();
|
||||
$stmt->close();
|
||||
return ["success" => true];
|
||||
|
|
Loading…
Reference in a new issue