No duplicate entries
This commit is contained in:
parent
43b1eb55d0
commit
6ea6fcddc3
|
@ -36,6 +36,9 @@ function register_event($cfg) {
|
||||||
$body = json_decode(file_get_contents('php://input'));
|
$body = json_decode(file_get_contents('php://input'));
|
||||||
$event_id = get_event_id($cfg, $body->event_token);
|
$event_id = get_event_id($cfg, $body->event_token);
|
||||||
$event_token = $body->event_token;
|
$event_token = $body->event_token;
|
||||||
|
if (get_event_id($cfg, $token)) {
|
||||||
|
return ["success" => false];
|
||||||
|
}
|
||||||
$query = "INSERT INTO events (token) VALUES (?)";
|
$query = "INSERT INTO events (token) VALUES (?)";
|
||||||
$stmt = $cfg['mysqli']->prepare($query);
|
$stmt = $cfg['mysqli']->prepare($query);
|
||||||
$stmt->bind_param("s", $event_token);
|
$stmt->bind_param("s", $event_token);
|
||||||
|
|
Loading…
Reference in a new issue