예제 #1
0
 public function saveInformation($userid)
 {
     //Writes JSON to file so we can load it later.
     $facepunch = new facepunch();
     $facepunch->setUserID($userid);
     //Opens/Creates a new file.
     $file = fopen($this->filepath["json"] . $userid . '.json', 'w');
     //Write information.
     if ($facepunch->getUserInformation(true)) {
         //Write the information too file.
         fwrite($file, $facepunch->getUserInformation(true));
     } else {
         return false;
     }
     //Close the file.
     fclose($file);
     //Return true
     return true;
 }
예제 #2
0
                 $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));
 }
 if ($_POST["action"] == "auth") {
     $response = array();
     $response["error"] = "false";