} } } } else { if ($_REQUEST['action'] == "checkin") { $ret->status = "success"; } } } echo json_encode($ret, JSON_PRETTY_PRINT); } else { $ret = new stdClass(); $username = $_REQUEST['username']; $blid = $_REQUEST['blid']; $ip = $_SERVER['REMOTE_ADDR']; $con = new ClientConnection(array($blid, $username, $ip)); $blAuth = $con->attemptBlocklandAuth(); if ($blAuth === true) { $ret->status = "success"; $ret->ident = $con->getIdentifier(); $con->setAuthed(true); if ($con->hasGlassAccount()) { $ret->debug = "glass account found"; } else { $userArray = $con->getUnverifiedAccounts(); if (sizeof($userArray) > 0) { $ret->action = "verify"; $verifyData = array(); foreach ($userArray as $user) { $verifyData[] = $user->getEmail(); }
<?php require_once dirname(__FILE__) . "/private/ClientConnection.php"; header('Content-Type: text/json; charset=ascii'); if (isset($_REQUEST['ident']) && $_REQUEST['ident'] != "") { $con = ClientConnection::loadFromIdentifier($_REQUEST['ident']); $ret = new stdClass(); if (!is_object($con)) { $ret->status = "fail"; error_log("Auth failed for ident " . $_REQUEST['ident']); } else { error_log("Auth pass for " . $_REQUEST['ident']); $ret->ident = $con->getIdentifier(); $ret->blid = $con->getBLID(); if ($ret->blid == 118256 || $ret->blid == 43364 || $ret->blid == 21186) { $ret->status = "barred"; $json = json_encode($ret, JSON_PRETTY_PRINT); die($json); } $ret->username = iconv("ISO-8859-1", "UTF-8", UserLog::getCurrentUsername($ret->blid)); error_log("Username is " . $ret->username); $ret->admin = false; $ret->mod = false; $user = UserManager::getFromBLID($ret->blid); if ($user !== false) { $ret->beta = false; if ($user->inGroup("Administrator")) { $ret->admin = true; $ret->mod = true; $ret->beta = true; } else {
/** * Called when the HTTP request headers have been received. * * @param HttpRequest $req * @param $success */ public function gotHeaders(HttpRequest $req, $success) { $stream = $req->getStream(); $streamId = $this->streams->getId($stream); // Remove the stream from the list, because the HttpRequest is listening to it. $this->streams->removeStream($streamId); if ($success) { $success = $this->performHandshake($req); } if (!$success) { fclose($stream); return; } // Send the stream events to this class. $streamId = $this->streams->addStream($stream, $streamId, $this); $connection = new ClientConnection($stream, $streamId); $connection->addEventListener($this); $this->connections[$streamId] = $connection; $e = $this->createEvent(WebSocketServer::EVENT_CONNECTED); $e->connection = $connection; $this->notifyEventListeners($e); }