diff --git a/public/verify.php b/public/verify.php index ed358af..3d78ef1 100644 --- a/public/verify.php +++ b/public/verify.php @@ -28,13 +28,15 @@ try { require_once("../database.php"); - $sql = "SELECT COUNT(*) FROM registrations WHERE verify_token = '" . $token . "' LIMIT 1;"; + $sql = "SELECT COUNT(*) FROM registrations WHERE verify_token = '" . $token . "'" + . " AND state = " . RegisterState::PendingEmailVerify . " LIMIT 1;"; $res = $db->query($sql); $first_name = NULL; $last_name = NULL; $note = NULL; $email = NULL; $admin_token = NULL; if ($res->fetchColumn() > 0) { - $sql = "SELECT first_name, last_name, note, email, admin_token FROM registrations WHERE verify_token = '" . $token . "' LIMIT 1;"; + $sql = "SELECT first_name, last_name, note, email, admin_token FROM registrations WHERE verify_token = '" . $token . "'" + . " AND state = " . RegisterState::PendingEmailVerify . " LIMIT 1;"; foreach ($db->query($sql) as $row) { // will only be executed once $first_name = $row["first_name"]; @@ -48,7 +50,7 @@ try { } require_once("../MatrixConnection.php"); - $adminUrl = $webroot . "/verify_admin.php?t=" . $admin_token; + $adminUrl = $webroot . "verify_admin.php?t=" . $admin_token; $mxConn = new MatrixConnection($homeserver, $access_token); $mxMsg = new MatrixMessage(); $mxMsg->set_body($first_name . ' ' . $last_name . "möchte sich registrieren und hat folgende Notiz hinterlassen:\r\n" @@ -73,13 +75,13 @@ try { print("
"); print("" . $language["VERIFICATION_SUCCESS_BODY"] . "
"); - print("Zur Registrierungsseite"); + print("Zur Registrierungsseite"); } catch (Exception $e) { print("" . $e->getMessage() . "
"); - print("Zur Registrierungsseite"); + print("Zur Registrierungsseite"); } ?>