nonce; ?>
'@'.$username.':imninja.net 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, 'password' => $_POST['password'], 'admin' => false ]; $content['mac'] = hash_hmac('sha1', $content['nonce']."\0".$content['username']."\0".$content['password']."\0".'notadmin', REGISTRATION_SHARED_SECRET); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, SYNAPSE_URL.'/_synapse/admin/v1/register'); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'content-type: application/json' ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($content)); 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 successful. To start using your new account please install a Matrix client like Element