diff --git a/index.php b/index.php index 612613c..5feb802 100644 --- a/index.php +++ b/index.php @@ -18,8 +18,10 @@ if (isset($_GET['secret']) && $_GET['secret'] === REGISTRATION_PASSWORD) { $response = curl_exec($ch); if (curl_error($ch) || curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) { echo 'Error retrieving nonce. Please try again later.'; - } else { - $nonce = json_decode($response)->nonce; + exit; + } + + $nonce = json_decode($response)->nonce; ?>
$decoded_response->user_id.' just registered', + 'msgtype' => 'm.text' + ])); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'authorization: Bearer '.ACCESS_TOKEN, + 'content-type: application/json' + ]); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $response = curl_exec($ch); + if ($curl_error($ch) || curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) { + echo 'Registration for "'.$username.'" unsuccessful. Please try again later.'; + exit; + } + $content = [ 'nonce' => $_POST['nonce'], 'username' => $username, @@ -58,16 +78,14 @@ if (isset($_GET['secret']) && $_GET['secret'] === REGISTRATION_PASSWORD) { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if (curl_error($ch) || curl_getinfo($ch, CURLINFO_HTTP_CODE) !== 200) { + echo 'Registration for "'.$username.'" unsuccessful. Please try again later.'; + exit; + } + + $decoded_response = json_decode($response); ?> -Registration for "" unsuccessful. Please try again later. - - - -Registration successful. To start using it please install a Matrix client like Element