// get the first value if ($values[0] == "u") { // Do checks here. $facepunch = new facepunch(); // Set the userid $facepunch->setUserID($values[1]); // Check to see if they have their messages disbabled. if ($facepunch->messagesDisabled()) { $response["error"] = "visitor messages are disabled"; } else { // if the user valid? if (!$facepunch->isUserValid()) { $response["error"] = "user is invalid"; } else { if ($facepunch->isGold() || $facepunch->isDeveloper() || $facepunch->isMod()) { $response["username"] = $facepunch->getUsername(); $response["avatar"] = $facepunch->getAvatar(); $response["userid"] = $facepunch->currentUserID(); $response["membership"] = $facepunch->getUserInformation()["membership"]; // Assuming the player is valid, we will now give him a key. $response["authenticationkey"] = $db->addAuthenticationKey($facepunch->currentUserID()); } else { $response["error"] = "not gold"; } } } } } } die(json_encode($response)); }
public function setCookies() { $facepunch = new facepunch(); $facepunch->setUserID($this->sessionToUserID(session_id())); //Set cookies setcookie("fpusername", $facepunch->getUsername()); setcookie("fpid", $facepunch->currentUserID()); unset($facepunch); }